Skip to main content

Make a payment with a card entered by a customer

In this guide, you will learn how to make a single payment with a payment card entered by a customer without associating it with a specific customer saved for the merchant user's account. This type of payment is most useful for quick processing of payment checkouts in which you don't store and manage any account data for your customers.

You will go through the following steps:

  1. Create a checkout
  2. Complete a checkout

When you complete these steps, you will have processed a payment with a payment card entered by a customer.

Before you begin

Here are the things that you need in order to complete the steps in this guide:

info

You can create and complete a payment checkout for any valid SumUp merchant user's account. As a result, you can use an access token obtained either via the Client credentials flow or via the Authorization code flow.

Steps

1. Create a checkout

To create a new checkout resource, make a POST request to the https://api.sumup.com/v0.1/checkouts endpoint.

caution

This request must be made in a server-to-server communication between your server and SumUp API.

The request body should be a JSON object with the following minimum details:

info

The table below lists only the required parameters for the request. For a full list of the available parameters, see the API Reference.

Attribute nameDescription
checkout_referenceA unique string identifying the payment in your system. It must be unique for your application.
amountThe amount for which the payment is made.
currencyThe three-letter ISO4217 code of the currency in which the payment is made. The value must match the currency registered for the merchant user to whom the payment is made (as specified in pay_to_email).
pay_to_emailThe email address of the registered merchant user to whom the payment is made.

Following is a sample request for creating a new checkout resource:

curl -X POST \
https://api.sumup.com/v0.1/checkouts \
-H 'Authorization: Bearer 565e2d19cef68203170ddadb952141326d14e03f4ccbd46daa079c26c910a864' \
-H 'Content-Type: application/json' \
-d '{
"checkout_reference": "CO746453",
"amount": 10,
"currency": "EUR",
"pay_to_email": "[email protected]",
"description": "Sample one-time payment"
}'

The response contains a JSON body with the details of the created checkout resource. What you need to note in the response is the identifier of the resource - you will need it for all operations that you perform with the resource, such as completing it in the next step.

The resource identifier is returned in the id attribute, or f14425c6-8bc1-4d02-957c-47573f762828 in the sample response below. The status attribute shows that the payment for this resource is pending and will be processed when you complete the checkout with the payment instrument details.

{
"checkout_reference": "CO746453",
"amount": 10,
"currency": "EUR",
"pay_to_email": "[email protected]",
"description": "Sample one-time payment",
"id": "f14425c6-8bc1-4d02-957c-47573f762828",
"status": "PENDING",
"date": "2018-09-28T13:47:01.832Z",
"transactions": []
}

2. Complete a checkout

To complete the checkout and trigger the payment, make a PUT request to the https://api.sumup.com/v0.1/checkouts/{id} endpoint, where the value of the {id} path parameter is the identifier of the checkout resource.

caution

This request must be made from your client, not from your server.

The request body should be a JSON object with the the payment type (card) and the payment card details. For more information about the request, see the API Reference.

Following is a sample request for completing the checkout from Step 1:

curl -X PUT \
https://api.sumup.com/v0.1/checkouts/f14425c6-8bc1-4d02-957c-47573f762828 \
-H 'Content-Type: application/json' \
-d '{
"payment_type": "card",
"card": {
"name": "Dominik Biermann",
"number": "4485618386833995",
"expiry_month": "05",
"expiry_year": "20",
"cvv": "257"
}
}

The response contains a JSON body with the details of the processed checkout resource in which the attributes related to the payment outcome are populated:

{
"checkout_reference": "CO746453",
"amount": 10.0,
"currency": "EUR",
"pay_to_email": "[email protected]",
"description": "Sample one-time payment",
"id": "f14425c6-8bc1-4d02-957c-47573f762828",
"status": "PAID",
"date": "2018-09-28T13:47:01.832Z",
"transaction_code": "TFDCP3FLQ7",
"transaction_id": "19aa3cca-89f6-42d2-b462-463b0b53e959",
"transactions": [
{
"id": "19aa3cca-89f6-42d2-b462-463b0b53e959",
"transaction_code": "TFDCP3FLQ7",
"merchant_code": "ME7RMQN3",
"amount": 10.0,
"vat_amount": 0.0,
"tip_amount": 0.0,
"currency": "EUR",
"timestamp": "2018-09-28T13:48:28.768Z",
"status": "SUCCESSFUL",
"payment_type": "ECOM",
"entry_mode": "CUSTOMER_ENTRY",
"installments_count": 1,
"auth_code": "585388",
"internal_id": 24118507
}
]
}

Result

You have made a payment with a payment card entered by a customer without associating it with a specific customer saved for a merchant user's account. If the payment is successful, the funds will be transferred to the merchant user according to the configured account settings.