<?php
$partner_array = array(
'PartnerId' => '6729',
);
$partner = (object) $partner_array;
$buyer_array = array(
'Email' => 'escrow.buyer@hotmail.com',
'Initiator' => 'false',
'CompanyChk' => 'false',
'AutoAgree' => 'false',
'AgreementChecked' => 'false',
);
$buyer = (object) $buyer_array;
$seller_array = array(
'Email' => 'escrow.seller@hotmail.com',
'Initiator' => 'false',
'CompanyChk' => 'false',
'AutoAgree' => 'false',
'AgreementChecked' => 'false',
);
$seller = (object) $seller_array;
$broker_array = array(
'Email' => 'escrow.broker@hotmail.com',
'Initiator' => 'true',
'CompanyChk' => 'true',
'AutoAgree' => 'true',
'AgreementChecked' => 'true',
);
$broker = (object) $broker_array;
// This array contains objects, which container the inner array
$line_items_container_array = array();
// Holds data about the line item
$line_items_inner_array = array(
'ItemName' => 'Line item 1',
'Description' => 'REST Service test line item',
'Quantity' => '1',
'Price' => '2500',
'Accept' => 'true',
'SellComm' => '100',
'BuyComm' => '50',
);
$line_items = (object) $line_items_inner_array;
$line_items_container_array[] = $line_items;
$json_array = array(
'Title' => 'JSON GM Broker Transaction (REST Service)',
'Description' => 'JSON GM Broker Transaction (REST Service)',
'TransactionType' => '1',
'EscrowPayment' => '0',
'ShipmentFee' => '25',
'ShipmentPayment' => '0',
'InspectionLength' => '6',
'Currency' => 'USD',
'Fulfillment' => '1',
'Disclosure' => '1',
'BrokerCommissionPayee' => 'Buyer',
'BrkCommissionBuyerPortion' => '18.1',
'BrkCommissionSellerPortion' => '19.1',
'CommissionType' => '1',
'InitiationDate' => '2014-04-15',
'TransactionLocked' => 'true',
'PartnerTransID' => '12345',
'TermsLocked' => 'true',
'AllowReject' => 'true',
'Partner' => $partner,
'Buyer' => $buyer,
'Seller' => $seller,
'Broker' => $broker,
'LineItems' => $line_items_container_array,
);
$json = json_encode($json_array);
print_r($json);
preferences:
51.52 ms | 402 KiB | 5 Q