Checkout

URL

Production: https://endpoints.yenepay.com/api/urlgenerate/getcheckouturl/  
Sandbox: https://testapi.yenepay.com/api/urlgenerate/getcheckouturl/ 

Description

Creates a new payment order on YenePay for the authenticated user and redirects to checkout application to complete the payment

Method

POST

Headers

Content-Type: application/json

Parameters

{
process (string): Checkout type for this payment. Should have a value of either Express or Cart. Use Express checkout type for single item payment and Cart if this payment includes more than one item.

merchantOrderId (string, optional): A unique identifier for this payment order on the merchant’s platform. Will be used to track payment status for this order.

merchantId (string): A unique merchant short code that is assigned to a merchant when signing up for a YenePay merchant account. Has a minimum of 4 digits and can be found after signing into YenePay account manager (https://www.yenepay.com/account)

items: [{
itemId (string, optional): A unique identifier of the item (SKU, UUID,…) that is used to identify the item on the merchant’s platform.
itemName (string): Name of the item. Required for Express type checkout
unitPrice (decimal): Amount in ETB currency. Required for Express type checkout
quantity (integer): Quantity of the item. Required for Express type checkout.
}],

successUrl (string, optional): A fully qualified URL endpoint on the merchant’s platform that will be used to redirect the paying customer after the payment has successfully been completed.

cancelUrl (string, optional): A fully qualified URL endpoint on the merchant’s platform that will be used to redirect the paying customer if this payment is cancelled by the customer.

ipnUrl (string, optional): A fully qualified URL endpoint on the merchant’s platform that will be used to send Instant Payment Notification to the merchant’s platform when a payment is successfully completed.

failureUrl (string, optional): A fully qualified URL endpoint on the merchant’s platform that will be used to redirect the paying customer if this payment fails

expiresAfter (integer, optional): Expiration period for this payment in minutes. This payment order will expire after the specified number of minutes, if specified.

expiresInDays (integer, optional): Expiration period for this payment in days. This payment order will expire after the specified number of days. The default value is 1 day.

totalItemsHandlingFee (decimal, optional): Handling fee in ETB currency for this payment order, if applicable. Set this value for Cart type checkout. When calculating total payment amount, this will be added to the cart items total amount.

totalItemsDeliveryFee (decimal, optional): Delivery or shipping fee in ETB currency for this payment order, if applicable. Set this value for Cart type checkout. When calculating total payment amount, this will be added to the cart items total amount.

totalItemsDiscount (decimal, optional): Discount amount in ETB currency for this payment order, if applicable. Set this value for Cart type checkout. When calculating total payment amount, this will be deducted from the cart items total amount.

totalItemsTax1 (decimal, optional): Tax amount in ETB currency for this payment order, if applicable. Set this value for Cart type checkout. When calculating total payment amount, this will be added to the cart items total amount.

totalItemsTax2 (decimal, optional): Tax amount in ETB currency for this payment order, if applicable. Set this value for Cart type checkout. When calculating total payment amount, this will be added to the cart items total amount.
}

Example Request

Express checkout
{
"process":"Express",
"successUrl":"http://my-success-url/",
"ipnUrl":"http://my-ipn-url/",
"merchantId":"0000",
"merchantOrderId":"ab-cd",
"expiresAfter":24,
"items":[
{
"itemId":"sku-01",
"itemName":"sample item",
"unitPrice":230,
"quantity":1
}
],
"totalItemsDeliveryFee":12.3,
"totalItemsTax1":35.5
}
Cart checkout
{
"process":"Cart",
"successUrl":"http://localhost/account",
"merchantId":"0325",
"merchantOrderId":"kajhk-kjh",
"expiresAfter":24,
"items":[
{
"itemId":"sku-01",
"itemName":"sample item",
"unitPrice":2300,
"quantity":1
},
{
"itemId":"sku-02",
"itemName":"sample item 2",
"unitPrice":2300,
"quantity":2
}
],
"totalItemsDeliveryFee":10,
"totalItemsTax1":320
}

Response

Success Response: 200
Body:
{
"result": "https://www.yenepay.com/_/link_code"
}
Error Response: 400
Body:

{
"message": "The request is invalid.",
"modelState": {
"error": [
"Too many items for Express checkout."
]
}
}
Error Response: 500
Body:

{
"message": "An error has occurred.",
"exceptionMessage": "An error occurred while sending the request."
}
Was this article helpful to you? Yes No 2

How can we help?