# Payments
source: https://developer.mastercard.com/account-to-account-commerce-for-dsp/documentation/use-cases/payments/index.md

## Overview {#overview}

The payment use case enables the debtor service provider to carry out three key operations. The debtor service provider can:  

* Enable a debtor to pay a creditor (merchant) with a linked account; this is accompanied by an optional notification for the debtor to log in to their mobile banking app.   
* Enable a debtor to link their account during the checkout process with a creditor for future purchases and set up recurring payments based on frequency, duration, and amount. It is a combined consumer experience that does not require the debtor to separately link their account.  
* Enable a creditor to support debtors making one-time purchases using their bank account without linking their accounts.  

Note: The debtor service provider is responsible for performing KYC on the debtor before initiating payment requests or agreement requests.

## Pay with Linked Account {#pay-with-linked-account}

The pay with linked account enables the debtors to pay a creditor with the account already linked to their registration. Upon receiving the payment request, the debtor service provider can either decide to perform additional authentication by stepping up or approve the payment request without a step-up. We will see both flows in detail below.

### Pay with Linked Account- Without Step-up {#pay-with-linked-account--without-step-up}

Diagram pay-with-link-single-device

The following are the execution steps:  

1. The debtor adds a few items to the cart and checkouts. The creditor sends the payment request with an agreement to the creditor service provider.  
2. The creditor service provider initiates the payment request with the agreement to Mastercard.  
3. Mastercard validates the request for data format and business rules and responds with the status of In-progress.  
4. Mastercard initiates the payment request with an agreement outbound notification to the debtor service provider by calling the `/agreement-payment-requests` endpoint.  
5. The debtor service provider acknowledges the payment request.   
6. The debtor service provider calls the Real-Time Payment Rails to initiate a credit transfer and captures the transaction reference. The debtor service provider then confirms the payment by initiating payment confirmation advice to Mastercard by calling the `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.  
7. Mastercard acknowledges the request.  
8. Mastercard sends the payment confirmation advice outbound request to the creditor service provider.  
9. The creditor service provider acknowledges the request.  
10. The creditor service provider updates the web/app interface.  

### Pay with Linked Account - With Step-up {#pay-with-linked-account---with-step-up}

Diagram pay-with-link-two-device

The following are the execution steps:  

1. The debtor adds a few items to the cart and checkouts. The creditor sends the payment request with an agreement to the creditor service provider.  
2. The creditor service provider initiates a payment request with the agreement to Mastercard.  
3. Mastercard validates the request for data format and business rules and responds with the status of In-progress.  
4. Mastercard initiates the payment request with an agreement outbound notification to the debtor service provider by calling the `/agreement-payment-requests` endpoint.  
5. The debtor service provider acknowledges the payment request.  
6. The debtor service provider decides to authenticate and sends a create step-up advice request to Mastercard by calling the `/payment-requests/{payment_request_lifecycle_id}/step-up-advices` endpoint. It also sends the link for step-up and the message to be displayed to Debtor.   
7. Mastercard acknowledges.  
8. Mastercard forwards the create step-up advice request to the creditor service provider.  
9. The creditor service provider acknowledges.  
10. The creditor redirects the debtor to the debtor service provider app.  
11. The debtor authenticates in the app.   
12. The debtor confirms the payment to the debtor service provider.  
13. The debtor service provider calls the Real-Time Payment Rails to initiate a credit transfer and captures the transaction reference. The debtor service provider then confirms the payment by initiating payment confirmation advice to Mastercard by calling the `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.  
14. Mastercard acknowledges and responds to the payment confirmation advice to the debtor service provider.  
15. Mastercard sends the payment confirmation advice outbound request to the creditor service provider.  
16. The creditor service provider acknowledges the request.  
17. The creditor service provider updates the web/app interface.  
18. The debtor is redirected to the creditor's web/app.   

## Link and Pay Account {#link-and-pay-account}

The link and pay (or pay and link) enables a debtor to link their account during the checkout process with a creditor for future purchases. It also enables setup of recurring/ subscription based payments. It is a combined consumer experience that does not require a debtor to separately link their account.   

The link and pay can be covered in two journeys:  

**Single device** : The debtor completes the user journey on a single mobile device, where the debtor is redirected to their bank app using the universal link.  

**Two devices** : The debtor completes the user journey with two devices. The creditor page displays a 6-digit numeric link reference number, which the debtor enters in the Account to Account Commerce section of their bank app to complete the journey.   

### Link and Pay- Single Device {#link-and-pay--single-device}

Diagram pay-and-link-single-device

The following are the execution steps:  

1. The debtor adds a few items to the cart and checkouts. The creditor sends the payment request to the creditor service provider.  
2. The creditor service provider initiates the payment request to Mastercard. The creditor service provider includes the agreement type as well in the payment request.  
3. Mastercard validates the request for data format and business rules and responds with the status of In-progress.  
4. The creditor uses the merchant library to display the list of debtor service providers (and their universal link) onboarded to Account to Account Commerce. The debtor chooses their debtor service provider and is redirected.  
5. The debtor authenticates in the app.  
6. The debtor service provider submits a retrieve payment request to Mastercard by calling the `/payment-request-retrievals` endpoint.  
7. Mastercard responds with the payment details as received from the creditor service provider to the debtor service provider. Mastercard also adds agreementType in the response as received from creditor service provider.  
8. The debtor service provider presents to the debtor the payment details and link details to authorize.  
9. The debtor responds to the payment and link.   
10. The debtor service provider calls the Real-Time Payment (RTP) Rails to initiate a credit transfer and captures the transaction reference. The debtor service provider then confirms the payment by calling payment confirmation advice to Mastercard using the `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint. The debtor service provider needs to mandatorily populate the agreementConfirmation block with the decision from Debtor.  
11. Mastercard acknowledges.  
12. Mastercard forwards the confirm payment advice to the creditor service provider.  
13. The creditor service provider acknowledges.  
14. The creditor service provider updates the web/app interface.  
15. The debtor is redirected to the creditor's web/app.   

Note: When the debtor is redirected to the debtor service provider app, the debtor service provider must send payment request retrieval within 250 seconds, failing which the payment would be timed out.

### Link and Pay- Two Device {#link-and-pay--two-device}

Diagram pay-and-link-two-device

The following are the execution steps:  

1. The debtor adds a few items to the cart and checkouts. The creditor sends the payment request to the creditor service provider.  
2. The creditor service provider initiates the payment request to Mastercard. The creditor service provider includes the agreement type as well in the payment request.  
3. Mastercard validates the request for data format and business rules and responds with a status of In-progress.  
4. The creditor service provider displays the reference number for the debtor to authenticate from a different device.  
5. The debtor manually opens the debtor service provider app and authenticates.  
6. The debtor enters the reference number to confirm the link.  
7. The debtor service provider receives the request and sends the retrieve payment link request by calling the `/payment-request-retrievals` endpoint to Mastercard.  
8. Mastercard responds with the payment details as received from the creditor service provider to the debtor service provider. Mastercard also adds agreementType in the response as received from creditor service provider.  
9. The debtor service provider presents to the debtor the payment details and link details to authorize.  
10. The debtor reviews and responds to the confirm and link request.  
11. The debtor service provider calls the Real-Time Payment Rails to initiate a credit transfer and captures the transaction reference. The debtor service provider then confirms the payment by calling the `/payment-requests/{payment_request_lifecycle_id}/ payment-confirmation-advices` endpoint to Mastercard. The debtor service provider needs to mandatorily populate the agreementConfirmation block with the decision from Debtor.  
12. Mastercard acknowledges.  
13. Mastercard forwards the confirm payment advice to the creditor service provider.  
14. The creditor service provider acknowledges.  
15. The creditor service provider updates the web/app interface.  
16. The debtor is redirected to the creditor's web/app.   

## Single Immediate Payment {#single-immediate-payment}

The single immediate payment service enables the creditor to support debtors making one-time purchases using their debtor account. With this use case, no linking will be established with the creditor for future payments.  

A single immediate payment can be covered in two journeys:   

**Single device** : The debtor completes the user journey in a single mobile device, where the debtor is redirected to their bank app using a universal link.   

**Two devices** : The debtor completes the user journey in two devices. The creditor page displays a 6-digit numeric link reference number, which the debtor enters in the Account to Account Commerce section of their bank app to complete the journey.  

### Single Immediate Payment- Single Device {#single-immediate-payment--single-device}

Diagram single-immediate-payment-single-device

The following are the execution steps:  

1. The debtor adds a few items to the cart and checkouts. The creditor sends the payment request to the creditor service provider.  
2. The creditor service provider initiates a payment request to Mastercard.  
3. Mastercard validates the request for data format and business rules and responds with a status of In-progress.  
4. The creditor uses the merchant library to display the list of debtor service providers (and their universal link) onboarded to Account to Account Commerce. The debtor chooses their debtor service provider and is redirected.  
5. The debtor authenticates.  
6. The debtor service provider submits a retrieve payment request to Mastercard by calling the `/payment-request-retrievals` endpoint.  
7. Mastercard responds with the payment details as received from the creditor service provider to the debtor service provider. agreementType will not be sent.   
8. The debtor service provider presents to the debtor the payment details to authorize.  
9. The debtor confirms the payment request.  
10. The debtor service provider calls the Real-Time Payment (RTP) rails to initiate a credit transfer and captures the transaction reference. The debtor service provider then confirms the payment by initiating payment confirmation advice to Mastercard by calling the `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.  
11. Mastercard acknowledges.  
12. Mastercard forwards the confirm payment advice to the creditor service provider.  
13. The creditor service provider acknowledges.  
14. The creditor and creditor service provider update the web/app interface.   
15. The debtor is redirected to the creditor's web/app.   

### Single Immediate Payment- Two Devices {#single-immediate-payment--two-devices}

Diagram single-immediate-payment-two-device

The following are the execution steps:  

1. The debtor adds a few items to the cart and checkouts. The creditor sends the payment request to the creditor service provider.  
2. The creditor service provider initiates the payment request to Mastercard.  
3. Mastercard validates the request for data format and business rules and responds with a status of In-progress.  
4. The creditor service provider displays the reference number for the debtor to authenticate from a different device. The debtor manually opens the debtor service provider app.  
5. The debtor authenticates in the app.  
6. The debtor enters the reference number in the Account to Account section of the app.  
7. The debtor service provider submits the retrieve payment request to Mastercard by initiating the `/payment-request-retrievals` endpoint.  
8. Mastercard responds with the payment details as received from the creditor service provider to the debtor service provider. agreementType will not be sent.   
9. The debtor service provider presents the payment details to the debtor to authorize.   
10. The debtor confirms the payment request.  
11. The debtor service provider calls the Real-Time Payment (RTP) rails to initiate a credit transfer and captures the transaction reference. The debtor service provider then confirms the payment by initiating payment confirmation advice to Mastercard by calling the `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.  
12. Mastercard acknowledges.  
13. Mastercard forwards the confirm payment advice to the creditor service provider.  
14. The creditor service provider acknowledges.  
15. The creditor and creditor service provider update the web/app interface.  

## Additional Information {#additional-information}

1. Look at the [API Reference](https://developer.mastercard.com/account-to-account-commerce-for-dsp/documentation/api-reference/index.md) for information on how to implement this use case.  
2. Look at the [Codes and Formats](https://developer.mastercard.com/account-to-account-commerce-for-dsp/documentation/code-and-formats/index.md) for acknowledgement responses.  
