APIYard
Back to APIs
PaymentsBearer Token

PayPal

Create orders, capture payments, and issue refunds globally using PayPal's REST APIs with support for one-time and subscription payments.

Base URL

https://api-m.paypal.com/v2
PayPalorderssubscriptionsrefundsglobal

Endpoints

POST/checkout/orders

Create a payment order to initiate checkout.

const response = await fetch("https://api-m.paypal.com/v2/checkout/orders", {
  method: "POST",
  headers: {
  "Content-Type": "application/json",
  "Authorization": "Bearer YOUR_ACCESS_TOKEN"
  },
  body: JSON.stringify({
  "intent": "CAPTURE",
  "purchase_units": [
    {
      "amount": {
        "currency_code": "USD",
        "value": "10.00"
      }
    }
  ]
})
});

const data = await response.json();
console.log(data);

Response Preview

{
  "id": "8F0R5VGBCR",
  "status": "CREATED",
  "links": [
    { "rel": "approve", "href": "https://www.paypal.com/checkoutnow?token=8F0R5VGBCR", "method": "GET" }
  ]
}