Find an API

Search public APIs with auth details & Postman guides

← All APIs

PayPal REST API

api-m.paypal.com · Finance

Finance OAuth2 Free Tier Payments Finance eCommerce

PayPal payments, orders, subscriptions, and invoicing. Sandbox with test accounts. OAuth2 client credentials. No monthly fee — transaction fees only.

Authentication

OAuth2 OAuth2 Client Credentials. Register at developer.paypal.com to get client_id and client_secret for sandbox and live.

Sample Requests

POST Create an order

Create a $10.00 PayPal order.

https://api-m.paypal.com/v2/checkout/orders

Hover any highlighted part to learn what it does

Headers — extra info sent with the request
Content-Type application/json
Authorization Bearer YOUR_TOKEN
PayPal-Request-Id request-001
Request Body — data you're sending
{
  "intent": "CAPTURE",
  "purchase_units": [
    {
      "amount": {
        "value": "10.00",
        "currency_code": "USD"
      }
    }
  ]
}
curl -X POST "https://api-m.paypal.com/v2/checkout/orders" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "PayPal-Request-Id: request-001" \
  -H "Content-Type: application/json" \
  -d '{"intent":"CAPTURE","purchase_units":[{"amount":{"value":"10.00","currency_code":"USD"}}]}'
import requests
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
    "PayPal-Request-Id": "request-001"
}
data = {
    "intent": "CAPTURE",
    "purchase_units": [
        {
            "amount": {
                "value": "10.00",
                "currency_code": "USD"
            }
        }
    ]
}
response = requests.post(
    "https://api-m.paypal.com/v2/checkout/orders",
    headers=headers,
    json=data,
)
print(response.json())
const url = 'https://api-m.paypal.com/v2/checkout/orders';

const response = await fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN',
    'PayPal-Request-Id': 'request-001'
  },
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "intent": "CAPTURE",
  "purchase_units": [
    {
      "amount": {
        "value": "10.00",
        "currency_code": "USD"
      }
    }
  ]
}),
}); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"bytes"
	"encoding/json"
)

func main() {
	targetURL := "https://api-m.paypal.com/v2/checkout/orders"
	jsonData, _ := json.Marshal({"intent":"CAPTURE","purchase_units":[{"amount":{"value":"10.00","currency_code":"USD"}}]})
	req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
	req.Header.Set("PayPal-Request-Id", "request-001")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://api-m.paypal.com/v2/checkout/orders")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["Authorization"] = "Bearer YOUR_TOKEN"
req["PayPal-Request-Id"] = "request-001"
req["Content-Type"] = "application/json"
req.body = "{\"intent\":\"CAPTURE\",\"purchase_units\":[{\"amount\":{\"value\":\"10.00\",\"currency_code\":\"USD\"}}]}"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api-m.paypal.com/v2/checkout/orders";
$opts = ["http" => [
    "method" => "POST",
    "header" => implode("\r\n", [
        "Content-Type: application/json",
        "Authorization: Bearer YOUR_TOKEN",
        "PayPal-Request-Id: request-001",
        "Content-Type: application/json"
    ]),
    "content" => json_encode({"intent":"CAPTURE","purchase_units":[{"amount":{"value":"10.00","currency_code":"USD"}}]}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Create a developer account at developer.paypal.com
  2. Get sandbox client_id and client_secret
  3. Get token: POST https://api-m.sandbox.paypal.com/v1/oauth2/token with basic auth
  4. Use api-m.sandbox.paypal.com for sandbox, api-m.paypal.com for production
  5. Test credentials at developer.paypal.com/tools/sandbox/accounts/

Open documentation ↗