login about faq

Hi Matt,

Can you please craft an example for me of how to use your HTTP library with the new Paypal oAuth/Rest payment gateway. All of the PayPal examples are written in cURL. The site for PayPal is developer.paypal.com

Thanks,

Erik

Step 1 - Access Token

curl https://api.sandbox.paypal.com/v1/oauth2/token 
 -H "Accept: application/json" 
 -H "Accept-Language: en_US" 
 -u "EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp" 
 -d "grant_type=client_credentials"

Step 2 - Make API call

curl -v https://api.sandbox.paypal.com/v1/payments/payment 
-H "Content-Type:application/json" 
-H "Authorization:Bearer EEwJ6tF9x5WCIZDYzyZGaz6Khbw7raYRIBV_WxVvgmsG" 
-d '{
  "intent": "sale",
  "payer": {
    "payment_method": "credit_card",
    "funding_instruments": [
      {
        "credit_card": {
          "number": "5500005555555559",
          "type": "mastercard",
          "expire_month": 12,
          "expire_year": 2018,
          "cvv2": 111,
          "first_name": "Joe",
          "last_name": "Shopper"
        }
      }
    ]
  },
  "transactions": [
    {
      "amount": {
        "total": "7.47",
        "currency": "USD"
      },
      "description": "This is the payment transaction description."
    }
  ]
}'

asked Apr 10 '13 at 15:09

emartinson's gravatar image

emartinson
148162030

bump | nudge

(Apr 17 '13 at 17:42) emartinson
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×186
×16
×8
×2
×2

Asked: Apr 10 '13 at 15:09

Seen: 2,023 times

Last updated: Apr 18 '13 at 05:33

powered by OSQA