Вопрос

I'm using Quickbooks' Hosted Paypage and I have, up to this point, managed to get everything to work except for the order information. I don't receive any errors. The paypage continues to work with or without the order-related code.

I'm unsure exactly how to go about this and I can't find any relevant examples. I assume that I'm formatting something incorrectly, but I have no idea what if I am.

Below is the relevant code. I took out the applogin and authticket, but those are correct.

<?php

$order = '{"Items":[
    {"ItemSku":"NA","ItemDesc":"Party Hats","ItemPrice":"1.00","ItemQty":"1","ItemIsShippable":"0","ItemIsTaxable":"0"},
    {"ItemSku":"NA","ItemDesc":"Extra Guests","ItemPrice":"1.08","ItemQty":"1","ItemIsShippable":"0","ItemIsTaxable":"0"}], 
    "EstDeliveryDate": "01/01/2080"}';

// I've tried with and without this line
$order = json_decode($order, true);

/*---------------------------------------
    Paypage
---------------------------------------*/
if ($NoErrors = true) {

// Intuit Base URL
$base_url   =   'https://paymentservices.intuit.com/';


// Construct URL for Intuit ticket 
$ticket = array(
                'AuthModel'     =>  'desktop',
                'AppLogin'      =>  'xxx.xxx.com',
                'AuthTicket'    =>  'xxx-xxx-xxxx',
                'TxnType'       =>  'Sale',
                'Amount'        =>  $Amount,
                'CustomerName'  =>  $CustomerFullName,
                'CustomerStreet'=>  $CustomerStreet,
                'CustomerCity'  =>  $CustomerCity,
                'CustomerState' =>  $CustomerState,
                'CustomerPostalCode'=> $CustomerPostalCode,
                'IsCustomerFacing' => '1'
                );

array_push($ticket, $order);

// Go to Intuit ticket URL
$ticket_url =   $base_url . "paypage/ticket/create?" . http_build_query($ticket);
$print_ticket = file_get_contents($ticket_url);

Thank you for your time!

Это было полезно?

Решение

After rereading the documentation, I found I missed 'Order=' from the URL. I removed the json_decode line and then added "'Order' => $order" to the end of my $ticket array. That got it working.

$ticket = array(
                'AuthModel'     =>  'desktop',
                'AppLogin'      =>  'xxxx',
                'AuthTicket'    =>  'xxxx',
                'TxnType'       =>  'Sale',
                'Amount'        =>  $Amount,
                'CustomerName'  =>  $CustomerFullName,
                'CustomerStreet'=>  $CustomerStreet,
                'CustomerCity'  =>  $CustomerCity,
                'CustomerState' =>  $CustomerState,
                'CustomerPostalCode'=> $CustomerPostalCode,
                'IsCustomerFacing' => '1', 
                'Order'         =>  $order
                );
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top