dimanche 16 novembre 2014

Pre-fill Adaptive Payments Form


Vote count:

0




Is it possible to pre-fill the form available at http://ift.tt/1A5Qlvl or the embedded ligthbox?


I have attempted both hidden fields in the lightbox form ie: name="first_name"


I have also attempted to do it via the adaptivepayments-sdk-php library using SetPaymentOptions() although I am not sure my implementation is correct. Please excuse the terrible code.



public function allInOneTest() {


$myPayPal = new Receiver();
$myPayPal->email = 'fake1@email.com';
$myPayPal->amount = '100';
$myPayPal->primary = true; // chain payment

$clientPayPal = new Receiver();
$clientPayPal->email = 'fake2@email.com';
$clientPayPal->amount = '90';

$receiverList = new ReceiverList([
$myPayPal,
$clientPayPal
]);

$payRequest = new PayRequest(
new RequestEnvelope('en_US'),
'CREATE',
URL::route('payments.cancel'),
'USD',
$receiverList,
URL::route('payments.return')
);

// so I pay the fee
$payRequest->feesPayer = 'PRIMARYRECEIVER';

$service = new AdaptivePaymentsService($this->config);

$response = $service->Pay($payRequest);

$payKey = $response->payKey;

$shippingAddressInfo = new ShippingAddressInfo();
$shippingAddressInfo->addresseeName = 'Person Name';
$shippingAddressInfo->street1= '1 Fake St';
$shippingAddressInfo->city= 'Fakesville';
$shippingAddressInfo->state= 'CA';
$shippingAddressInfo->country= 'US';

$so = new SenderOptions();
$so->shippingAddress = $shippingAddressInfo;

$do = new DisplayOptions();
$do->businessName = 'Testing';

$setPaymentOptionsRequest = new SetPaymentOptionsRequest(
new RequestEnvelope('en_US'),
$payKey,
$do,
null,
null,
$so
);
$service2 = new AdaptivePaymentsService($this->config);
$response2 = $service2->SetPaymentOptions($setPaymentOptionsRequest);

return 'http://ift.tt/1kBNxh9' . $payKey;


}


asked 55 secs ago







Pre-fill Adaptive Payments Form

Aucun commentaire:

Enregistrer un commentaire