Question regarding Payment V2 API (Using PHP SDK)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am setting up a system for my local scout troop to accept dues payments and event payments. I have it working, but PayPal is wanting either a shipping tracking number (um, these aren't goods to be shipped) or to have anyone sending a payment to go back in 2 days later and confirm the payment... Without this manual step, they're putting any funds on hold, and we have to go through customer support to get funds released...
Is anyone in a similar situation (intangible goods and in-person services) having similar issues? Is there a way (The API docs are not helping) to streamline this so that PayPal is not expecting these to be ship-able goods? Do I need additional parameters in the request, or the line items?
The code to set up the request is (some items omitted for clarity):
$request = new OrdersCreateRequest();
$request->prefer('return=representation');
$request->body = array(
'intent' => 'CAPTURE',
'application_context' => array(
'return_url' => 'https://742scouts.org/user.php?action=paypalsuccess',
'cancel_url' => 'https://742scouts.org/user.php?action=paypalcancel'
),
'purchase_units' => array( 0 => array(
'description' => 'Payment to ' . $unit_name .' Scout Account',
'soft_descriptor' => 'ScoutAccount',
'amount' => array(
'currency_code' => 'USD',
'value' => number_format( floatval($amount), 2, ".","" )
)
) ),
'items' => array( 'name' => 'Payment to Scout Account',
'description' => 'Payment to Scout Account, for ' . $scout['name'],
'sku' => 'pymt',
'unit_amount' => array(
'currency_code' => 'USD',
'value' => number_format( floatval($scout['amount']), 2, ".","" )
),
'quantity' => '1',
'category' => 'DIGITAL_GOODS',
)
);
$client = PayPalClient::getClient();
response = $client->execute($request);
which then we grab the $response->result->id and pass it back to the front end JavaScript when it displays the button...
For capture, we use
$request = new OrdersCaptureRequest($json_obj['orderID']);
$client = PayPalClient::getClient();
$response = $client->execute($request);
from which we extract the return code from the response and check for
$response->result->status == "COMPLETED" && $response->result->purchase_units[0]->payments->captures[0]->final_capture == true
- Labels:
-
REST SDK
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Add Others data in SDKs
- Getting errors when integrating standard checkout with my web site. Probably a beginner problem. in SDKs
- Button in PayPal Payments Standard
- Need help to integrate Advanced Checkout (PPCP) With WHMCS in PayPal Upgrade Community
- I want to implement subscription functionality. in REST APIs