PayPal REST Payment API with javascript only (using another server for handling requests)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd like to implement a payment process on a static website. Does this flow look safe?
- User opens a Payment page
- At this time, there is an ajax request is sent to remote server in order to retrieve Access-Token. This token is saved somewhere on the client (hidden field or localStorage)
- User fills up CC data (Name, CC number, CVV etc.) and clicks "Proceed" button
- Another request with this token is sent to PayPal payment API
{ "intent": "authorize", "payer": { "payment_method": "credit_card", "funding_instruments": [ { "credit_card": { "number": "00000000000000", "type": "visa", "expire_month": 08, "expire_year": 2018, "cvv2": 111, "first_name": "Betsy", "last_name": "Buyer" } }] }, "transactions": [ { "amount": { "total": "33.33", "currency": "USD" }, "invoice_number": "123456" }] }
Does it look good? Are there any better approaches?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks good to me. Just make sure you have an SSL installed on the site and everything runs through it. Also make sure you aren't saving any CC data in your database, log files, or anything like that.
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. That's a precious opinion since I haven't been able to get any confirmation of my concerns for about 2 weeks. I'll go with this implementation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's funny. It turned out I can't accept CC payments. I should have tried enabling live before.
Here's what I got:
Disclaimer: Unfortunately, due to recent product changes in the region, we are no longer able to allow Live DCC processing via RESTful APIs to Canada. We are continually looking for ways to expand our services, so please stay tuned. We apologize for any inconvenience this may cause.
Looking for another way of accepting cc payments.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ouside of REST API's you could use the classic NVP/SOAP API's if you are based in US/Canada/UK. Otherwise Braintree might be the way to go:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to upgrade my account to PRO in order to use NVP/SOAP API to charge credit cards, right?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Questions about how to securely notify servers using JavaScript SDK in PayPal Payments Standard
- Subscription API in REST APIs
- Transaction Status Pending for too long in Sandbox in Sandbox Environment
- Transaction Status Pending for too long and Payout denied eventually in Sandbox in Sandbox Environment
- How to get PayPal Client Metadata Id in SDKs