# Venmo for Unified Payments API
> **Note**
>
> We no longer support new Venmo integrations on the Payments API. For new PayPal integrations, use the [Payment Setup API](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-using-the-payment-setup-api.md).
The payment flow varies depending on the payment experience you want to offer and how you capture the payment. The following steps guide you through the process:
1. [Configure the front-end PayPal JS SDK](#Configure_the_front-end_PayPal_JS_SDK).
2. [Request a Checkout.com payment context](#Request_a_Checkout.com_payment_context).
3. [Display the Venmo button](#Display_the_Venmo_button).
If you offer a _Continue_ payment experience, you must [get the latest customer data from PayPal](#Retrieve_customer_data_from_PayPal) to create an _order review_ page.
4. [Request a payment](#Request_a_payment).
If you're using a manual capture payment, you must also [capture the payment](#Manually_capture_the_payment).
### Configure the front-end PayPal JS SDK
You can use the JavaScript SDK to render the buttons and payment method icons in any page of your store.
1. Initialize the PayPal JS SDK by adding it in a ``
You must configure the PayPal JS SDK query parameters as follows:
| Query Parameter | Description |
| --- | --- |
| `client-id` | This value varies if you are using a live or sandbox environment:
The client ID for the Checkout.com environment you are configuring the SDK for.
If you are configuring your:
- Sandbox environment – Use the value: `ASLqLf4pnWuBshW8Qh8z_DRUbIv2Cgs3Ft8aauLm9Z-MO9FZx1INSo38nW109o_Xvu88P3tly88XbJMR`.
- Production environment – Use the value: `ATbi1ysGm-jp4RmmAFz1EWH4dFpPd-VdXIWWzR4QZK5LAvDu_5atDY9dsUEJcLS5mTpR8Wb1l_m6Ameq`. |
| `merchant-id` | Your PayPal merchant ID.
Checkout.com will provide you with your ID during your integration. |
| `enable-funding` | Enables the funding sources for the transaction. This value must be `venmo`. |
| `disable-funding` | Specifies which funding sources to disable for the transaction.
Checkout.com only supports PayPal Direct Payment. You must set this query parameter to `&disable-funding=credit,card,sepa`. |
| `commit` | Specifies which checkout experience button to display in the PayPal pop-up:
- To display a _Pay Now_ button, set the query parameter to `true`.
- To display a _Continue_ button, set the query parameter to `false`. |
Additionally, you must configure the following script parameter as follows:
| Script Parameter | Value |
| --- | --- |
| `data-partner-attribution-id` | `CheckoutLtd_PSP` |
2. Place a `
` wrapper on the page you want to render the PayPal button:
```html
```
3. Add a `
```
The [PayPal JavaScript configuration](https://developer.paypal.com/sdk/js/configuration/) documentation provides additional information.
### Request a Checkout.com payment context
A Checkout.com payment context request will return an `order_id`, which is required when configuring subsequent requests.
To make it easier to reconcile the payment at a later date, include the following fields in your request:
- `reference`
- `processing.invoice_id`
> **Information**
>
> The Payment Context API supports [idempotency](https://www.checkout.com/docs/developer-resources/api/idempotency.md). You can safely retry API requests without the risk of duplicate requests.
> **Information**
>
> Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md).
**Production**
`POST` `https://{prefix}.api.checkout.com/payment-contexts`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payment-contexts`
#### Request example
```json
{
"source": {
"type": "paypal"
},
"currency": "USD",
"amount": 2000,
"capture": false,
"items": [
{
"name": "laptop",
"unit_price": 2000,
"quantity": 1
}
],
"processing": {
"invoice_id": "12345",
"user_action": "pay_now"
},
"processing_channel_id": "{{PayPal-processingChannel-personal}}",
"success_url": "http://www.example.com/success.html",
"failure_url": "http://www.example.com/failure.html"
}
```
You can find the full list, as well as complete request and response examples, in our [API reference](https://api-reference.checkout.com/).
#### Response example
If you receive a `201 Created` success status response code your request was successful. In the response, you will receive an order ID in the` partner_metadata` field. Use this order ID in the PayPal SDK for the `createOrder()` method.
```json
{
"id": "pct_ckjrpk7vux4ejhghe6ssgkoy2y",
"partner_metadata": {
"order_id": "7YP86878G2990415D"
},
"_links": {
"self": {
"href": "https://{prefix}.api.checkout.com/payment-contexts/pct_ckjrpk7vux4ejhghe6ssgkoy2y"
}
}
}
```
#### Pay Now experience
Use the _Pay Now_ checkout experience if you know the final payment amount when you initiate the payment flow:
1. Set the `user_action` field to `pay_now` in the request.
2. Include `commit=true` in the JS script URL to display a _Complete purchase_ button in the flow.
When the customer selects _Complete purchase_, the payment is completed without requiring any further action from them.
#### Continue experience
Use the _Continue_ checkout experience if you want to present PayPal as an option upfront for a faster checkout experience and higher conversion rates.
1. Set the `user_action` field to `continue` in the request.
2. Include `commit=false` in the JS script URL to display a _Continue to Review Order_ button in the flow.
> **Information**
>
> If you do not specify the `user_action` field in your request, the _Continue_ payment flow is used by default.
When the customer selects _Continue to Review Order_, they will be redirected to the PayPal payment page. There, customers can edit their shipping address or adjust their shipping option before submitting the order.
While the customer is on the PayPal page, you can update their shopping cart to include additional shipping costs. PayPal provides shipping configuration in the `shipping_preference` field using the following values:
- `no_shipping` – Shipping does not have to be defined, usually for digital goods and services where physical delivery is not required.
- `set_provided_address` – The customer uses the merchant-provided address; the customer can only update the address if you do not provide one.
- `get_from_file` – Collects the shipping details from the PayPal widget. This is the default value.
> **Information**
>
> If you set `"shipping_preference": "set_provided_address"` the following fields are required:
>
> - `address_line1`
> - `country`, as a two-character [country code](https://www.checkout.com/docs/developer-resources/codes/country-codes.md)
### Display the Venmo button
Manage the order via the PayPal JS SDK:
- In the `createOrder()` handler of your script, use the `order_id` returned from the payment context request.
- Use the `onApprove()` handler to continue to the next step in your payment flow after your customer transaction is approved.
If you implement a _Continue_ checkout experience, you must:
1. [Retrieve the latest customer data](https://api-reference.checkout.com/tag/Payment-Context/#operation/getPaymentContext) after the customer confirms payment in PayPal pop-up.
2. Display this information on the _Review Order_ page.
You can use the updated information from the payment context when you request a payment later.
In the front end, once the customer confirms the payment in the PayPal pop-up, you can use the `onApprove()` callback function to get information from the user’s session on PayPal’s side. The response will contain all fields required to create the payment.
> **Information**
>
> Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md).
**Production**
`GET` `https://{prefix}.api.checkout.com/payment-contexts/{id}`
**Sandbox**
`GET` `https://{prefix}.api.sandbox.checkout.com/payment-contexts/{id}`
#### Response example
```json
{
"payment_request": {
"source": {
"type": "paypal"
},
"amount": 2000,
"currency": "USD",
"payment_type": "Regular",
"authorization_type": "Final",
"capture": false,
"customer": {
"name": "Toby Arden",
"email": "apm-payer@personal.example.com"
},
"shipping": {
"first_name": "Toby Arden",
"address": {
"address_line1": "1 Main St",
"city": "San Jose",
"state": "CA",
"zip": "95131",
"country": "US"
}
},
"items": [
{
"name": "laptop",
"quantity": 1,
"unit_price": 2000
}
],
"success_url": "http://www.example.com/success.html",
"failure_url": "http://www.example.com/failure.html",
"processing_channel_id": "pc_zmcw5ppbvr3ullkdlza6u4teoi"
},
"partner_metadata": {
"customer_id": "WDB9U9PV7Y2KY",
"order_id": "7YP86878G2990415D"
}
}
```
### Request a payment
> **Information**
>
> Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md).
**Production**
`POST` `https://{prefix}.api.checkout.com/payments`
**Sandbox**
`POST` `https://{prefix}.api.sandbox.checkout.com/payments`
#### Request example
On the final order review page, the customer has the option to update the following details, which may affect the total payment amount:
- Shipping address
- Shipping method
If the customer does not make any changes, you can use the following request example:
```json
{
"payment_context_id":"pct_ckjrpk7vux4ejhghe6ssgkoy2y",
"processing_channel_id": "{{NAS-processingChannel-personal}}"
}
```
If the customer updates either of the shipping details, you must provide updated values in your payment request. Your request should only include the fields impacted by the customer's update to the shipping details. For example:
- The new `shipping.address`
- The new `amount`, to reflect the change in shipping method or address
#### Response example
Your request was successful if you receive a `202 Success` response code which contains the `status` field set to `Pending`.
```json
{
"id": "pay_z7wmqrxtmkouzlhhvyxuc3ecxq",
"status": "Pending",
"customer": {
"id": "cus_qypaijolqf5enei2y5b5men32m",
"email": "sb-278ci3399829@business.example.com",
"name": "Toby Arden"
},
"processing": {
"partner_order_id": "7YP86878G2990415D"
},
"_links": {
"self": {
"href": "https://{prefix}.api.checkout.com/payments/pay_z7wmqrxtmkouzlhhvyxuc3ecxq"
}
}
}
```
You can choose to automatically capture the payment, or capture it manually at a later time. By default, PayPal is configured to auto capture the payment.
- To automatically capture the payment: set `"capture": true` in the payment context request.
- To manually capture the payment: set `"capture": false` in the payment context request and set `&intent=authorize` query parameter in the JS SDK call:
`