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

Payments use case enables the creditor service provider to initiate a request for pay message to debtor service providers. The payment supports the following use cases:   

* Pay with a Linked Account   
* Recurring Payments   
* Pay and Link to the Debtor Account   
* Single Immediate Payment

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

The pay with linked account service enables creditors to present a payment request to a debtor who has already linked their account. 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 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

The following are the execution steps:  

1. The debtor logins to the creditor app/wesbite, adds few items to the cart, and checkouts. The creditor sends the payment request with agreement to the creditor service provider.   
2. The creditor service provider initiates a payment request with an agreement by calling the `/payment-requests` endpoint. Always populate the agreementId. agreementType if populated should be same as in Agreement Creation request or accepeted values under that agreementType. For example, if agreementType is AMRT in Agreement creation, AOF or MRT are accepted values of agreementType in Payment Request API.  
3. Mastercard validates the request for data format, business rules and responds with the status of In-Progress.  
4. Mastercard forwards the payment request with agreement to the debtor service provider.  
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 calling payment confirmation advice to Mastercard.  
7. Mastercard sends the payment confirmation advice outbound request to the creditor service provider by calling the `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.  
8. The creditor service provider acknowledges the request.  
9. The creditor updates the web/app interface.  

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

Diagram pay-with-link-2

The following are the execution steps:  

1. The debtor logins to the creditor app/wesbite, 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 agreement by calling the `/payment-requests` endpoint. Always populate the agreementId. agreementType if populated should be same as in Agreement Creation request or accepeted values under that agreementType. For example, if agreementType is AMRT in Agreement creation, AOF or MRT are accepted values of agreementType in Payment Request API.  
3. Mastercard validates the request for data format and business rules and responds with the status of In-Progress.  
4. Mastercard forwards the payment request with agreement to the debtor service provider.  
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. It also sends the link for step-up and the message to be displayed to the debtor.  
7. Mastercard acknowledges.  
8. Mastercard forwards the create Step-up advice request to the creditor service provider by calling the `/payment-requests/{payment_request_lifecycle_id}/step-up-advices` endpoint.   
9. The creditor service provider acknowledges.  
10. The creditor displays the message to the debtor to redirect them to the debtor service provider app for authentication.  
11. The debtor authenticates.  
12. The debtor reviews the order and confirms the payment.  
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 calling payment confirmation advice to Mastercard.  
14. Mastercard sends the payment confirmation advice outbound request to the creditor service provider by calling `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoints.   
15. The creditor service provider acknowledges the request.  
16. The creditor updates the web/app interface.   
17. The debtor is redirected to the creditor's web/app.   

Note: During this flow, the creditor should ensure to display a waiting icon to the debtor until they receive the payment confirmation.

## Recurring Payments {#recurring-payments}

The recurring payment service enables the creditor to initiate recurring payment requests based on parameters agreed upon when the debtor linked their account.

Diagram recurring-payment

The following are the execution steps:  

1. The creditor initiates a payment request with the agreement to the creditor service provider.  
2. The creditor service provider initiates a payment request with agreement by calling the `/payment-requests` endpoint. Always populate the agreementId. agreementType if populated should be same as in Agreement Creation request or accepeted values under that agreementType. For example, if agreementType is AMRT in Agreement creation, AOF or MRT are accepted values of agreementType in Payment Request API.   
3. Mastercard validates the request for data format and business rules and responds with a status of In-Progress.  
4. Mastercard forwards the payment request with agreement to the debtor service provider.  
5. The debtor service provider acknowledges and sends a push notification to the debtor.   
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 calling payment confirmation advice to Mastercard.  
7. Mastercard sends the payment confirmation advice outbound request to the creditor service provider by calling the`/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.   
8. The creditor service provider acknowledges the request.  
9. The creditor updates the web/app interface.   

## Link and Pay to Debtor Account {#link-and-pay-to-debtor-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.   

Pay and link can be covered in two journeys:  

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

**Two Devices** : A 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 to Debtor Account - Single Device {#link-and-pay-to-debtor-account---single-device}

Diagram pay-and-lnk

The following are the execution steps:  

1. The debtor logins to the creditor app/website, 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 by calling `/payment-requests` to Mastercard. Populate the agreementType with no agreementId.   
3. Mastercard validates the request for data format and business rules and responds with the status of In-progress. agreementStatus will also be In-progress.  
4. The creditor uses the merchant library or Retrieve Debtor Service Providers API to display the list of the 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 service provider submits retrieve payment request to Mastercard.  
6. Mastercard responds with the payment details as received from the creditor service provider to the debtor service provider. Mastercard also adds link request elements in the response.  
7. The debtor service provider presents to the debtor the payment details and link details to approve.  
8. 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.  
9. Mastercard acknowledges.  
10. Mastercard forwards confirm payment advice by calling `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices`endpoint. Mastercard will populate agreementConfirmation block which will contain the agreementStatus.   
11. The creditor service provider acknowledges.   
12. The creditor updates the web/app interface and displays the payment confirmation. Creditor also would provide the status of the agreement.   
13. The debtor is redirected to the creditor's app/website.   

### Link and Pay to Debtor Account - Two Device {#link-and-pay-to-debtor-account---two-device}

Diagram pay-and-lnk-2

The following are the execution steps:   

1. The debtor logins to the creditor app/website, adds 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 by calling `/payment-requests` to Mastercard. Populate the agreementType with no agreementId.   
3. Mastercard validates the request for data format and business rules and responds with the status of In-progress. agreementStatus will also be 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. The debtor enters the reference number in the Account to Account Commerce section of the app.   
6. The debtor service provider validates the reference number and retrieves payment from Mastercard.  
7. The Mastercard sends payment details as received from the creditor service provider.  
8. The debtor service provider presents to the debtor the payment details and link details to authorize.   
9. 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.  
10. Mastercard acknowledges.  
11. Mastercard forwards the confirm payment advice by calling `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices`endpoint. Mastercard will populate agreementConfirmation block which will contain the agreementStatus.  
12. The creditor service provider acknowledges.  
13. The creditor updates the web/app interface and displays the payment confirmation. Creditor also would provide the status of the agreement.   

Note: During this flow, the creditor should ensure to display a waiting icon to the debtor until they receive the payment confirmation.

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

The Single immediate payment service enables the creditor to support debtors making one-time purchase 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 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.  

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

Diagram single-immediate-payment

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 by calling `/payment-requests` to Mastercard. Do not populate agreementId and agreementType.  
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 or Retrieve Debtor Service Providers API 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 service provider submits the retrieve payment request to Mastercard.  
6. Mastercard responds with the payment details as received from the creditor service provider to the debtor service provider.  
7. The debtor service provider presents to the debtor the payment details to authorize.  
8. The debtor confirms the payment request.  
9. 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.  
10. Mastercard acknowledges.  
11. Mastercard forwards the confirm payment advice by calling the `/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.  
12. The creditor service provider acknowledges.  
13. The creditor updates the web/app interface.   
14. The debtor is redirected to the creditor's web/app.   

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

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 a payment request by calling `/payment-requests` to Mastercard. Do not populate agreementId and agreementType.  
3. Mastercard validates the request for data format and business rules and responds with the 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. The debtor enters the reference number in the Account to Account section of the app.   
6. The debtor service provider validates the reference number and submits the retrieve payment request to Mastercard.  
7. Mastercard responds with the payment details as received from the creditor service provider to the debtor service provider.  
8. The debtor service provider presents the payment details to the debtor 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 calling the payment confirmation advice to Mastercard.  
11. Mastercard forwards the confirm payment advice by calling the`/payment-requests/{payment_request_lifecycle_id}/payment-confirmation-advices` endpoint.  
12. The creditor service provider acknowledges.  
13. The creditor updates the web/app interface and displays the payment confirmation.   

Note: During this flow, the creditor should ensure to display a waiting icon to the debtor until they receive the payment confirmation.

### Additional Information {#additional-information}

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