- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a subscription button that I integrated with the Paypal API. After a subscription I get these informations:
{ orderId: "ORDERID", subscriptionId: "SUBSCRIPTIONID" }
I need to get the capture_id which is the id of the captured payment after the user subscribed.
After searching through the doc, I know that to get the capture_id I have to do this request:
curl -X GET https://api.paypal.com/v2/checkout/orders/<order_id> \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <access_token>"
I should have the capture_id in the purchase_units fields returned by the request, but the purchase_units field I get is an empty array.
I found out that the status of my order is "APPROVED" and I need to have the status as "CAPTURED" to get the purchase_units. To do this I need to make this request:
curl -X POST https://api.paypal.com/v2/checkout/orders/<order_id>/capture \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <access_token>"
But when I do that I get the error: "INTERNAL_SERVER_ERROR". (debug_id: e90328ffb24c8)
Also I don't understand why the order I get has the status "APPROVED" and not directly "CAPTURED", since when I go check on the user test account I have the payment which is done.
Can anyone help me on that ? I'm completly blocked and don't know what to do...
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @electo ,
Thank you for posting to the PayPal Community.
For subscription payments you will not have a capture id, but you can get the associated transaction id for the subscription. Since Subscriptions payments do not need to be captured, this is why you will receive an error message if you attempt to capture a subscription.
When you crate the subscription, a subscription id is returned in the response. That subscription id starts with an I- and its followed by 12 alpha numeric characters. If you run a Get call to the list transactions for subscription endpoint, inputting the subscription id that you received in your response when you created the subscription, the response will include the transaction id that was generated. The formatting of the date range is below:
https://api.sandbox.paypal.com/v1/billing/subscriptions/{{SubsiptionID}}/transactions?start_time=2023-01-29T07:50:20.940Z&end_time=2023-02-06T07:50:20.940Z
If you are subscribed to webhooks your listener will receive a "PAYMENT.SALE.COMPLETED" webhook which includes the transaction id, and the subscription id.
Thank you,
Jennifer
MTS
PayPal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @electo ,
Thank you for posting to the PayPal Community.
For subscription payments you will not have a capture id, but you can get the associated transaction id for the subscription. Since Subscriptions payments do not need to be captured, this is why you will receive an error message if you attempt to capture a subscription.
When you crate the subscription, a subscription id is returned in the response. That subscription id starts with an I- and its followed by 12 alpha numeric characters. If you run a Get call to the list transactions for subscription endpoint, inputting the subscription id that you received in your response when you created the subscription, the response will include the transaction id that was generated. The formatting of the date range is below:
https://api.sandbox.paypal.com/v1/billing/subscriptions/{{SubsiptionID}}/transactions?start_time=2023-01-29T07:50:20.940Z&end_time=2023-02-06T07:50:20.940Z
If you are subscribed to webhooks your listener will receive a "PAYMENT.SALE.COMPLETED" webhook which includes the transaction id, and the subscription id.
Thank you,
Jennifer
MTS
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jennifer, thank you for your reply,
I am currently trying the solution with the webhook using "PAYMENT.SALE.COMPLETED".
I can get the payment_id through this, but i have a problem, very often the webhook isn't called (in sandbox). I don't really know why i feel like the sandbox environment still has some bugs, i hope it doesn't happen in the real environment.
Maybe i'll try the method using the api.
Thanks again for the reply,
Have a nice day

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- How to enable on-demand / recurring payments to existing PayPal checkout? in SDKs
- How do you create subscriptions with PayPal Advanced Checkout? in SDKs
- subscription_id has disappeared in REST APIs
- Paypal subscription Api in REST APIs
- Recurring Payment issue in Braintree Client-side Integration (JS, iOS, Android SDKs)