Cannot capture order after order Creation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to use the PayPal REST API to create and capture an order. I think I may be misunderstanding how it works.
My request (shown below) creates an order, I then use the response I get back to open the payment window. I fill in the test details here and then I'm redirected to my return URL indicating success. Here is where I'm unclear on what to do next in order to capture the order. I've checked the test business account and the payment has not shown up there, for this reason I know it hasn't gone through.
FYI - when I land on the return url I have
*domain*?token=**NUM**&PayerID=**NUM**
In the address bar, can either of these two values be used to complete the order?
return axios({
method: 'post',
url: 'https://api-m.sandbox.paypal.com/v2/checkout/orders',
headers: { 'content-type': 'application/json', Authorization: accessToken },
data: {
intent: 'CAPTURE',
purchase_units: [
{
amount: {
currency_code: 'GBP',
value: amount
}
}
],
application_context: {
brand_name: 'Noods',
locale: 'en',
user_action: 'PAY_NOW',
payment_method: {
payer_selected: 'PAYPAL',
payee_preferred: 'IMMEDIATE_PAYMENT_REQUIRED'
},
return_url: 'http://localhost:3000/',
cancel_url: ''
}
}
})
.then(response => {
return response.data
})
.catch(error => {
console.log(error)
})
I've been going round in circles with this so any help would be much appreciated!
Thanks,
George
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Need help to integrate PayPal Standard Checkout with Shopify in PayPal Payments Standard
- PAYER_ACTION_REQUIRED returned for Capture intent when calling v2 checkout orders in Sandbox Environment
- API TRANSACTION_REFUSED in Sandbox when Capturing Payment in REST APIs
- When clicking on a payment button generates error: Unexpected token ... in PayPal Payments Standard
- Simple Paypal button integration results in 404 error in Sandbox Environment