# PayNow for Payment Setup API To accept PayNow payments, you must: 1. Create a payment setup. 2. Confirm the payment. 3. Redirect the customer to PayNow. --- ## Create a payment setup Call the [Create a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/createAPaymentSetup) endpoint. > **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/setups` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups` ### Request example ```json { "amount": 1000, "currency": "SGD", "processing_channel_id": "pc_wzjki6hw5puepb5fnvqlizj2e4", "reference": "ORD-5023-4E89", "settings": { "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure" } } ``` In the request body, provide the following: | Field | Description | | --- | --- | | `amount`
`number` | The payment amount, in the [minor currency unit](https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value).

Minimum: 1

**Required** | | `currency`
`string` | Three-letter ISO 4217 [currency code](https://www.checkout.com/docs/developer-resources/codes/currency-codes.md).

Supported value: `SGD`

**Required** | | `processing_channel_id`
`string` | The [processing channel's](https://www.checkout.com/docs/business-operations/use-the-dashboard/manage-processing-channels.md) unique identifier.

**Required** | | `settings.failure_url`
`string` | The URL to redirect the customer to if the payment fails.

Format: URI

Max length: 1024

**Required** | | `settings.success_url`
`string` | The URL to redirect the customer to after a successful payment.

Format: URI

Max length: 1024

**Required** | | `customer.phone.country_code`
`string` | The country calling code for the customer's phone number.

Min length: 1

Max length: 7 | | `customer.phone.number`
`string` | The customer's phone number.

Max length: 25 | | `description`
`string` | A description of the payment.

Max length: 100 | | `reference`
`string` | A unique reference for the payment.

Max length: 80 | ### Response example ```json { "id": "set_rcmepwrchqab2wsergcafvijfy", "processing_channel_id": "pc_wzjki6hw5puepb5fnvqlizj2e4", "amount": 1000, "currency": "SGD", "payment_type": "Regular", "reference": "ORD-5023-4E89", "payment_methods": { "paynow": { "status": "ready", "flags": [] } }, "available_payment_methods": [ "paynow" ], "settings": { "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure" } } ``` The response returns a `payment_methods` object, which contains the payment methods enabled on your account. Providing all required fields sets the `payment_methods.paynow` object to a `ready` [status](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-using-the-payment-setup-api.md#Payment_method_status). --- ## Confirm the payment Confirm the payment by calling the [Confirm a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/confirmAPaymentSetup) endpoint and provide: - The payment setup `id` as the `{id}` path parameter. - `paynow` as the `{payment_method_name}` path parameter. ### Request example **Production** `POST` `https://{prefix}.api.checkout.com/payments/setups/{id}/confirm/paynow` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups/{id}/confirm/paynow` ### Response example If you receive a `202 Accepted` response with a payment `id` value and the `status` field set to `Pending`, your request was successful. ```json { "id": "pay_wwfb2jkxfwvu7ebiincw3ibbmi", "status": "Pending", "payment_type": "Regular", "_links": { "self": { "href": "https://{prefix}.api.sandbox.checkout.com/payments/pay_wwfb2jkxfwvu7ebiincw3ibbmi" }, "redirect": { "qr_code": { "image": "", "text": "00020126570009SG.PAYNOW01012000Singapore62200116pn_71f6dfc1763b4" } } } } ``` --- ## Redirect the customer Take the `_links.redirect.qr_code.text` value from the confirm response and convert it into a QR code using a third-party QR code generator tool. Display the QR code to the customer. The customer must scan the QR code using their online banking app and confirm the transaction. After the customer completes the payment, Checkout.com redirects them to your `settings.success_url` or `settings.failure_url`. > **Information** > > The QR code is valid for five days. The payment expires if the customer does not authorize the payment within this time. Checkout.com communicates the capture of the payment using webhooks. When you receive a `payment_captured` webhook, it indicates that the transaction has been successfully completed. PayNow only supports auto-capture payments. > **Information** > > You cannot void an auto-captured payment. To reverse a payment in progress, wait for the payment to be captured, and then process a refund.