# For Payments
source: https://developer.mastercard.com/straight-through-processing/documentation/use-cases/case-1/index.md

## Make a payment {#make-a-payment}

To submit a payment to a Supplier, the Supplier must be onboarded to the appropriate STP Payment Gateway "Provider" and subsequently registered with the STP API. Once your Suppliers are successfully onboarded and [registered with STP](https://developer.mastercard.com/straight-through-processing/documentation/use-cases/case-3/index.md#register-a-supplier), you can send payments to the Supplier.   

The execution steps are as follows:

1. The Issuer makes a `GET` call to the Providers\* endpoint.
2. STP delivers a list of Providers to the Issuer in HATEOAS using the _links.self.href format.
3. The Issuer makes a `POST` call to the Suppliers endpoint using the following details:
   * Provider's ID: Found in the _links.self.href section in the customFields section returned in the previous call.
   * STP Payment Gateway ID: Provided by Mastercard after onboarding the Supplier within STP.
4. STP generates and returns a unique STP ID in HATEOAS using the _links.self.href format.
5. The Issuer makes a `POST` call to the Payments endpoint to submit a payment to the Supplier. The following details are sent in the `POST`call:
   * The payment details.
   * STP ID: Found in the _links.self.href section returned in the previous call.
6. STP routes the payment to the Provider.
7. The Provider acknowledges the receipt of the payment.
8. STP returns a unique Payment ID\*\* in HATEOAS using the _links.self.href format.

Tip: It is recommended not to hardcode any IDs provided by the STP API. Diagram makepayment2

\*STP has four different Providers, with each serving the following regions:

* TNS serves North America (NAM) and Latin America and the Caribbean (LAC)
* MPGS-EU serves Europe
* MPGS-AP serves Asia Pacific (AP) and the Middle East and Africa (MEA)
* MPGS-IN serves India

From the Providers customFields section, select the key and name of the Provider from the region where your Supplier exists.

\*\*Please ensure you have stored the Payment ID. Customers will not be able to find that Payment ID if they do not store this data themselves.

Refer to [Testing](https://developer.mastercard.com/straight-through-processing/documentation/testing/case-1/index.md) for more information on how to execute the use case in the Sandbox environment.


API Reference: `GET /providers`


API Reference: `POST /suppliers`


API Reference: `POST /payments`

<br />

## Retrieve payment details {#retrieve-payment-details}

Once an STP payment is made, the STP platform returns a unique Payment ID. Please use this unique Payment ID to retrieve STP payment details.

The execution steps are as follows:

1. The Issuer makes a `GET` call to the Payments endpoint using the Payment ID returned from the `POST` Payments API call.
2. STP returns the payment details. Diagram getpaydet1

Refer to [Testing](https://developer.mastercard.com/straight-through-processing/documentation/testing/case-1/index.md) for more information on how to execute the use case in the Sandbox environment.

API Reference: `GET /payments/{id}`

## Retrieve payment status {#retrieve-payment-status}

Once an STP payment is made, the STP platform returns a unique Payment ID. Please use this unique Payment ID to retrieve STP payment status.

The execution steps are as follows:

1. The Issuer makes a `GET` call to the Status endpoint within the Payments endpoint using the payment ID which was returned from the `POST` Payments API call.
2. STP returns if the PaymentStatus\* is "completed" (true / false) and "successful" (true / false). Diagram getpaystat1

\*PaymentStatus  

Completed false: pending   

Completed true: finality of transaction

Learn more about STP's PaymentStatus [here](https://developer.mastercard.com/straight-through-processing/documentation/parameters/index.md#paymentstatus)

Refer to [Testing](https://developer.mastercard.com/straight-through-processing/documentation/testing/case-1/index.md) for more information on how to execute the use case in the Sandbox environment.

API Reference: `GET /payments/{id}/status`

