Hope this save some time for someone. The concept is for each products there will be one or more subscription plan. End users will be presented with the Subscription plans. And they will buy the subscription. The subscription plans can be created from both Paypal Dashboard and using REST API. Here is the REST API… Continue reading JSON for Creating Paypal Subscription Plan
Category: PHP
Paypal REST API create products
Request URL https://api-m.paypal.com/v1/catalogs/products Method: Post Header Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxx is base64 encoded Client ID:Secret // base64_encode(client_id_string:client_secret_string) – note the colon in between PayPal-Request-Id:TEST-REQ-ID-12345 —- This is optional. Passing this will make consequent requests work on same initial Request. Better to omit it. Body { “id”: “YOUR OWN PRODUCT ID”, “name”: “NAME”, “status”: “ACTIVE”,… Continue reading Paypal REST API create products
Paypal REST API get token
Request URL https://api-m.paypal.com/v1/oauth2/token Method Post Headers Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // xxxxxxxxxxxxxxxx is base64 encoded Client ID:Secret // base64_encode(client_id_string:client_secret_string) – note the colon in between Body grant_type:client_credentials Return { “scope”: “https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer https://uri.paypal.com/services/payments/realtimepayment https://uri.paypal.com/services/disputes/update-seller https://uri.paypal.com/services/payments/payment/authcapture openid https://uri.paypal.com/services/disputes/read-seller https://uri.paypal.com/services/payments/refund https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/payments/.* https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks”, “access_token”: “AYYYYYYYYYYWmTopNAjV__Yuk_6AP9RZWQpzxxxxxxxxxxxxxx1ifvHLHrE6RW_Zqjbieo3jcZr9999999999999999lyDA”, “token_type”: “Bearer”, “app_id”: “APP-XYXYXYXYXYXYCCCC”, “expires_in”: 32400, “nonce”: “2021-06-18T16:42:YUKJUKJHTGTYJKHGRRFHFHFGFGBFBG-spy-N9iguUHTJbTgVjht” }
Cross Origin or CORS Issue
We often get the CORS error when we try to run some code from localhost or XAMPP. The following steps will help to solve it. Please note you will need access to server side code or server configurations. Set Access-Control-Allow-Origin to “*” in the code Set Header set Access-Control-Allow-Headers to “*” in the code If… Continue reading Cross Origin or CORS Issue