Payment Gateway
APIs

Starting and operating a business can be a challenge, don't allow limitations to receive payments to impact your business.

How Payment Gateway Works

Understand The Payment Gateway Flow

Imagine you have a shop and you want people to be able to buy things from you, right? Well, instead of dealing with cash directly, a payment gateway lets your customers pay using different methods like credit cards or mobile money payments. It's like having a super helpful assistant that takes care of all the payment details.

When a customer wants to buy something, the payment gateway securely processes their payment and transfers the money to your account. It keeps everything organized and makes sure you get paid for your hard work.

So, in a nutshell, a payment gateway helps businesses like yours collect money from customers in a safe and convenient way. It's like having a reliable partner that takes care of all the payment stuff for you!

How To Use Payment Gateway

Given below is a complete end-to-end flow about how you can use Yeah Payment Gateway.

Payment StagesOrder StateDescriptions
Stage INot CreatedObtain Authentication Token
Stage IICreatedCreate an Order
Stage IIIReady to to be paidReceive payments from the Payment Gateway checkout library

Obtain Authentication Token

Capture and store the obtained authentication token for later use in subsequent API requests.

1 2 3 4 5 6 7 8 curl --location 'https://api.getyea.io/api/v1/token/auth/' \ --header 'Content-Type: application/json' \ --data '{ "username": "your_phone_number", "password": "your_password" }'

Handy Tips

You can capture payments automatically with the one-time Payment Capture setting configuration on the Yeah Dashboard.

Create an Order

Here is a sample code to show how to create an Order on Yeah, but you need to get a token first.

1 2 3 4 5 6 7 8 9 10 11 curl --location 'https://api.getyeah.io/api/v1/orders' \ --header 'Authorization: Token [YOUR_TOKEN]' \ --header 'Content-Type: application/json' \ --data '{ "amount": "1", "currency": "RWF", "receipt": "receipt", "notes": "notes" }'

Handy Tips

Do not have a website or mobile app? You can still accept payments by using other Yeah products such as Payment Links and Payment Pages. Find the Yeah product that best suits your business needs.

Add the Payment Gateway to your Website

Here is a sample code to show how to take payments on your website using the Yeah Payment Gateway checkout library

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 <html> <body> <button id="pay-button">Pay</button> </body> <script src="https://checkout.getyeah.io/v1/checkout.js"></script> <script> const options = { key: "[YOUR_KEY_ID]", amount: 1, currency: "RWF", name: "Your Company LLC", description: "Test Transaction", image: "https://your.company.logo/file.png", order_id: "[ORDER_ID]", handler: function (response) { // Do something here based on the outcome of the payment console.log(response); }, prefill: { name: "Ishmwe James", email: "ishmwe@example.com", contact: { country_code: "250", number: "780698188", }, }, }; const checkout = new YeahCheckout(options); document .getElementById("pay-button") .addEventListener("click", function () { checkout.open(); }); </script> </html>

Request Parameters

Here Is The List Of Parameters For using the Payment Gateway

Key

Mandatory

This property represents the Yeah key ID. It is a unique identifier associated with your Yeah account and is necessary for authenticating and processing payments.

Amount

Mandatory

Specifies the amount of the transaction. In this case, it's set to 1, which could be the smallest unit of the currency (e.g., 1 RWF or 1 of the specified currency).

Currency

Mandatory

The currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.

Name

Mandatory

Represents the name of your company or the entity receiving the payment. It's used to display the recipient's name during the checkout process.

Description

Optional

Provides a brief description of the transaction. In this example, it's set to "Test Transaction."

Order ID

Mandatory

This property represents the order ID associated with the transaction. It helps in tracking and identifying specific orders. You should replace "[ORDER_ID]" with the actual order ID for each transaction.

Handler

Optional

A callback function that will be executed after the payment is completed. In the provided example, it logs the payment response to the console. You can customize this function to perform actions based on the outcome of the payment.

Prefill

Optional

Contains information about the customer to pre-fill the checkout form. It includes:

  • name: The name of the customer ("Ishmwe James" in this example).
  • email: The email address of the customer.
  • contact: Information about the customer's contact, including the country code and phone number.

Page Links

This links will redirect you to the respective page for information.