Create a Payment Request
Last updated: Aug 15th, 8:08am
For PayPal Plus for Brazil, see the Brazilian integration guide.
After receiving your access token, use it to issue a request to create a payment. Set the following request fields to these values:
Parameter | Value |
---|---|
intent |
sale |
payment_method |
paypal |
allowed_payment_method |
IMMEDIATE_PAY |
Example request
1curl -v https://api-m.sandbox.paypal.com/v1/payments/payment \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer <Access-Token>' \4 -d '{5 "intent": "sale",6 "payer": {7 "payment_method": "paypal"8 },9 "transactions": [{10 "amount": {11 "currency": "BRL",12 "total": "93.00",13 "details": {14 "shipping": "11",15 "subtotal": "75",16 "shipping_discount": "1.00",17 "insurance": "1.00",18 "handling_fee": "1.00",19 "tax": "6.00"20 }21 },22 "description": "This is the payment transaction description",23 "payment_options": {24 "allowed_payment_method": "IMMEDIATE_PAY"25 },26 "item_list": {27 "shipping_address": {28 "recipient_name": "PP Plus Recipient",29 "line1": "Gregório Rolim de Oliveira, 42",30 "line2": "JD Serrano II",31 "city": "Votorantim",32 "country_code": "BR",33 "postal_code": "18117-134",34 "state": "São Paulo",35 "phone": "0800-761-0880"36 },37 "items": [{38 "name": "handbag",39 "description": "red diamond",40 "quantity": "1",41 "price": "75",42 "tax": "6",43 "sku": "product34",44 "currency": "BRL"45 }]46 }47 }],48 "redirect_urls": {49 "return_url": "https://example.com/return",50 "cancel_url": "https://example.com/cancel"51 }52}'
Example response
The response returns the approval_url
link, which is required when you are integrating the payment selection page.
1{2 "id": "PAY-3A3234483P2338009KTTFX7Q",3 "create_time": "2015-02-19T21:56:14Z",4 "update_time": "2015-02-19T21:56:14Z",5 "state": "created",6 "intent": "sale",7 "payer": {8 "payment_method": "paypal",9 "payer_info": {10 "shipping_address": {}11 }12 },13 "transactions": [{14 "amount": {15 "total": "95.00",16 "currency": "BRL",17 "details": {18 "subtotal": "75.00",19 "tax": "6.00",20 "shipping": "11.00",21 "handling_fee": "1.00",22 "insurance": "1.00",23 "shipping_discount": "1.00"24 }25 },26 "description": "This is the payment transaction description",27 "item_list": {28 "items": [{29 "name": "handbag",30 "sku": "product34",31 "price": "75.00",32 "currency": "BRL",33 "quantity": "1",34 "description": "red diamond",35 "tax": "6.00"36 }],37 "shipping_address": {38 "recipient_name": "Max Santos",39 "line1": "Greg?rio Rolim de Oliveira, 42",40 "line2": "JD Serrano II",41 "city": "Votorantim",42 "state": "S?o Paulo",43 "phone": "0800-761-0880",44 "postal_code": "18117-134",45 "country_code": "BR"46 }47 },48 "related_resources": []49 }],50 "links": [{51 "href": "https://api-m.sandbox.paypal.com/v1/payments/payment/PAY-3A3234483P2338009KTTFX7Q",52 "rel": "self",53 "method": "GET"54 }, {55 "href": "https://api-m.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-82237386YH588524U",56 "rel": "approval_url",57 "method": "REDIRECT"58 }, {59 "href": "https://api-m.sandbox.paypal.com/v1/payments/payment/PAY-3A3234483P2338009KTTFX7Q/execute",60 "rel": "execute",61 "method": "POST"62 }]63}