I am trying to integrate PayPal Express Checkout using PayPal Payment REST API. I want our clients to allow their user to pay using PayPal Express Checkout.
I dont see any documentation on their site explaining about how to integrate express checkout using their user API Username, Password and Signature, instead using Oauth credential Client ID/Token.
Do i have to use adaptive payment method?
https://devtools-paypal.com/guide/expresscheckout/php?interactive=ON&env=sandbox
https://developer.paypal.com/docs/api/#create-a-payment
$paypal_context = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential('client-id', 'client-token')
);
// $paypal_context->setConfig(
// array(
// 'mode' => 'sandbox',
// 'acct.UserName' => '',
// 'acct.Password' => '',
// 'acct.Signature' => ''
// )
// );
// OR
//$paypal_context = new \PayPal\Rest\ApiContext(
// array(
// 'mode' => 'sandbox',
// 'acct1.UserName' => '',
// 'acct1.Password' => '',
// 'acct1.Signature' => ''
// )
//);
$payer = new \PayPal\Api\Payer();
$amount = new \PayPal\Api\Amount();
$transaction = new \PayPal\Api\Transaction();
$payment = new \PayPal\Api\Payment();
$redirectUrls = new \PayPal\Api\RedirectUrls();
$payer->setPaymentMethod('paypal');
...
$payment->create($paypal_context);
$approvalUrl = $payment->getApprovalLink();