Skip to content

Instantly share code, notes, and snippets.

@makasim
Created August 9, 2011 14:19
Show Gist options
  • Save makasim/1134154 to your computer and use it in GitHub Desktop.
Save makasim/1134154 to your computer and use it in GitHub Desktop.
payment creation
<?php
$ppc = $this->paymentPluginController;
$price = '66.00';
$currency = 'USD';
$instruction = new PaymentInstruction($price, $currency, 'paypal_express_checkout', new ExtendedData());
$ppc->createPaymentInstruction($instruction);
$paymentId = $ppc->createPayment($instruction->getId(), $price)->getId();
$paymentUrl = $this->router->generate('foo_payment_url', array('paymentId' => $paymentId), true);
$instruction->getExtendedData()->set('return_url', $paymentUrl, false);
$instruction->getExtendedData()->set('cancel_url', $paymentUrl, false);
$ppc->createPaymentInstruction($instruction);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment