Create and manage reusable Payment Links through a REST API so your systems can generate, update, and delete payment links programmatically. Payment links collect payments by sharing a URL with customers. You can send a payment link directly through text or email and embed it on your website. The Payment Links and Buttons API currently supports payment links only and does not return button code. This API is available in all countries where PayPal operates. See Countries and Currencies for a list of supported currencies.Documentation Index
Fetch the complete documentation index at: https://docs.paypal.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Set up a PayPal Business Account.
- Navigate to the Apps and Credentials section on the PayPal Developer Dashboard and select Create App or select an existing one.
- Confirm Payment Links & Buttons is enabled for the selected credentials.
- Implement OAuth 2.0 to obtain an access token for each API call.
- Use
https://api-m.sandbox.paypal.comfor sandbox orhttps://api.paypal.comfor production. Payloads and steps are the same for both environments.
Quick start
Follow these steps to create your first payment link using the sandbox environment.1. Get an access token
Send aPOST request to get an OAuth 2.0 bearer token.
access_token that you pass in the Authorization header for subsequent calls.
2. Create a payment link
Send aPOST request with the minimal required product details.
3. Use the payment_link URL
The API returns HTTP status 201 Created, the payment resource id, and a payment_link URL. Share this URL with customers or embed it behind a button on your site.
4. Verify the link
Open thepayment_link URL in a browser, confirm the product name and price, and complete a test checkout using a sandbox buyer account. Use the payment_link value from the links array in the response.
How it works
The Payment Links and Buttons API exposes a simple lifecycle for Payment Links:- Get an OAuth access token for your PayPal Business account.
- Create a payment resource by calling
POST /v1/checkout/payment-resources. - Share the returned
payment_linkURL with customers. - Optionally list, retrieve, update, or delete existing payment resources as your catalog changes.
Endpoints
This section summarizes each endpoint. See the full API reference for the complete schema and additional examples.| Use case | Endpoint | Request | Response |
|---|---|---|---|
| Create payment links | POST /v1/checkout/payment-resources | Include product details in the request body, such as name, price, description, variants, taxes, shipping information, and the return URL. | Returns 201 Created with the payment link ID, shareable link URL, status, and creation timestamp. |
| List all payment links | GET /v1/checkout/payment-resources | This endpoint does not require a payload. Use optional query parameters such as page_size to control results per page and page_token for pagination. | Returns 200 OK with an array of payment links and pagination metadata. |
| Get payment link details | GET /v1/checkout/payment-resources/{id} | Use the payment link ID in the URL path to retrieve details. | Returns 200 OK with complete details for the specified payment link. |
| Update payment link | PUT /v1/checkout/payment-resources/{id} | Use the payment link ID in the URL path. Include the complete, updated product information in the request body. | Returns 200 OK with the updated payment link details. |
| Delete payment link | DELETE /v1/checkout/payment-resources/{id} | Use the payment link ID in the URL path to delete it permanently. | Returns 204 No Content to confirm successful deletion. |
Use cases
See how to create payment links that address common scenarios and requirements.Create a payment link (POST /v1/checkout/payment-resources)
Create a payment link that points to a PayPal‑hosted checkout experience. Use this endpoint to generate shareable payment URLs for your products.
Request
Response
The response includes the payment resource ID, shareable payment link, product details, and configuration. The API returns HTTP status 201 Created with content typeapplication/json.
List payment resources (GET /v1/checkout/payment-resources)
Retrieve a paginated list of all payment resources created by the merchant. This endpoint supports filtering through query parameters, such as status.
Request
Response
The response contains an array of payment resources and pagination links. The API returns HTTP status200 OK with content type application/json.
Get payment resource details (GET /v1/checkout/payment-resources/{id})
Get the details of a specific payment resource by its unique ID. This endpoint returns all metadata, including payment status, link URL, reusable type, and line item details.
Request
Response
Update payment resource (PUT /v1/checkout/payment-resources/{id})
Replace the configuration of a specific payment resource with new product and checkout details.
Request
Response
The API typically returns HTTP status204 No Content. In some cases, it may also return a confirmation body:
Delete payment resources (DELETE /v1/checkout/payment-resources/{id})
Permanently delete a payment resource by its unique ID.
Request
Response
The API returns HTTP status204 No Content with no response body.
Error handling
| HTTP code | Error name | Error message | Common cause |
|---|---|---|---|
400 | INVALID_REQUEST | Request is not well-formed, syntactically incorrect, or violates the schema. | Missing required payment resource fields such as item name, amount, and return URL in the body. |
403 | NOT_AUTHORIZED | Authorization failed due to insufficient permissions. | The access token is expired or lacks the correct OAuth scopes, and the merchant account doesn’t have permission for payment buttons. |
404 | RESOURCE_NOT_FOUND | The specified resource does not exist. | The payment resource ID is wrong, expired, or deleted. You may have tried to fetch, update, or delete a link or button that no longer exists. |
422 | UNPROCESSABLE_ENTITY | The requested action could not be performed, is semantically incorrect, or failed business validation. | Invalid payment amount, unsupported currency, or business rule violation, such as a duplicate payment link. |
500 | INTERNAL_SERVER_ERROR | An internal server error has occurred. | Temporary disruption during payment link or button processing. Retry the request or contact support if the issue persists. |
Test
- Create a sandbox account through the PayPal Developer Portal.
- Use your sandbox environment for all development and testing. All endpoints are duplicated for the sandbox (
api-m.sandbox.paypal.com) and live environments. See Card testing to simulate transactions in the sandbox. - To test live behavior, create a low‑value payment link, complete a test purchase, and verify the transaction in the Activity section of your PayPal account. Refund the test transaction after verification.