I can't use Billing Agreements API when I use live mode.
Hisapon
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Nov-11-2021
06:30 PM
I want to get details for a billing agreement, by ID.
https://developer.paypal.com/docs/api/payments.billing-agreements/v1/#billing-agreements_get
I run the following code, but I get an error.
It worked fine in sandbox mode.
The specified AgreementID definitely exists
from paypalrestsdk import BillingAgreement, ResourceNotFound
import paypalrestsdk
import logging
paypalrestsdk.configure({
"mode": "live",
"client_id": "***",
"client_secret": "***"
})
logging.basicConfig(level=logging.INFO)
billing_agreement = BillingAgreement.find("I-5D3XDN2D5FH1")
print("Got Billing Agreement Details for Billing Agreement[%s]" % (
billing_agreement.state))
This is error.
INFO:paypalrestsdk.api:Request[POST]: https://api.paypal.com/v1/oauth2/token
INFO:paypalrestsdk.api:Not logging full request/response headers and body in live mode for compliance
INFO:paypalrestsdk.api:Response[200]: OK, Duration: 1.132728s.
INFO:paypalrestsdk.api:Request[GET]: https://api.paypal.com/v1/payments/billing-agreements/I-5D3XDN2D5FH1
INFO:paypalrestsdk.api:Not logging full request/response headers and body in live mode for compliance
INFO:paypalrestsdk.api:Response[404]: Not Found, Duration: 0.788210s.
Traceback (most recent call last):
File "test_paypal_api.py", line 15, in <module>
billing_agreement = BillingAgreement.find("I-5D3XDN2D5FH1")
File "/Users/***/Library/Python/3.8/lib/python/site-packages/paypalrestsdk/resource.py", line 110, in find
return cls(api.get(url, refresh_token=refresh_token), api=api)
File "/Users/***/Library/Python/3.8/lib/python/site-packages/paypalrestsdk/api.py", line 268, in get
return self.request(util.join_url(self.endpoint, action), 'GET', headers=headers or {}, refresh_token=refresh_token)
File "/Users/***/Library/Python/3.8/lib/python/site-packages/paypalrestsdk/api.py", line 171, in request
return self.http_call(url, method, data=json.dumps(body), headers=http_headers)
File "/Users/***/Library/Python/3.8/lib/python/site-packages/paypalrestsdk/api.py", line 214, in http_call
return self.handle_response(response, response.content.decode('utf-8'))
File "/Users/***/Library/Python/3.8/lib/python/site-packages/paypalrestsdk/api.py", line 231, in handle_response
raise exceptions.ResourceNotFound(response, content)
paypalrestsdk.exceptions.ResourceNotFound: Failed. Response status: 404. Response message: Not Found. Error message: {"name":"RESOURCE_NOT_FOUND","debug_id":"317d0e924039","message":"The requested resource was not found","information_link":"https://developer.paypal.com/docs/api/payments.billing-agreements#errors","details":[{"issue":"Requested resource ID was not found."}]}
Labels:
- Labels:
-
Payments REST APIs
-
Subscriptions
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- The error when trying to get billing agreement token for not US locations in Sandbox Environment
- How do I find the BAID (Billing agreement ID) of my customers? in PayPal Payments Standard
- can we assign a unique detail to every subscription creation? in NVP/SOAP APIs
- Can't process subscription on Wordpress website in PayPal Payments Standard
- PayPal API 403 PERMISSION_DENIED on get order and capture order in REST APIs