Page cover image

Payment Links

When you created a new product, sometimes you would like to have a special payment link for each of your customer with some params or special price, your asked us and yes now it's possible

To create a new payment link you just need a create a product, update product is optional and you don't need it run PATCH to make product published and ready for selling

You can create a new product via Create a Product or use your existed product which was previously created/configured via UI Obtain :productId via UI

POST https://api.mel.store/api/mel-store/products/:productId/payment-links

Example of payload


{
       "prices": [
        {
            "currency_id": 2,
            "price": 2500,
            "is_discount_price": true,
            "discount_price": 2000
        },
        {
            "currency_id": 1,
            "price": 100000,
            "is_discount_price": false
        }
    ],
    "use_once": true,
    "metadata" : {
        "order_id": "559472095N",
        "name": "Alex Brown",
        "shop_url": "https://google.com/"
    }
}

Field

Description

metadata

optional, is array of your arbitrary metadata in key:value format, for example order_id from integrations or other arbitrary key-values.

it can be received and processed, please see After Sell Webhook section

use_once

Boolean, optional, default: false Possible values: true or false.

If you would like to limit your payment link to a one-time sale only, you can set it to true.

prices

required, array of prices in different currencies, one product can has one price in the same currency

prices.*.currency_id

required, int, id of currency, 2 is USD

prices.*.price

required, float or int, price of you product with cents for e.g 100.55 is $100.55

prices.*.is_discount_price

required, boolean, true of false, you can specify discount price to your product to better sells, so your price would be crossed out and customer will see next to it your discount_price amount

prices.*.discount_price

required_if, float or int. discount price of you product with cents for e.g 90.55 is $90.55. Discount price must be lower than price

Example of response

{
    "uuid": "92297aed",
    "metadata": {
        "order_id": "559472095N",
        "name": "Alex Brown",
        "shop_url": "https://google.com/"
    },
    "payment_link": "https://mel.store/jehkinen/165?uuid=92297aed",
    "use_once": false
}

🤔 Explanation

payment_link is a link to checkout page with price and metadata which you've specified while created it.

Payment links are not editable, once you created it then it can't be changed

Also when you create a payment link then your product will be auto published and ready for selling, you can skip update product step if you create at least one payment link for a product.

You can combine default price and payment link prices to better experience.

For example you can PATCH your product with one price and it will be available by basic checkout with this price by link

https://mel.store/jehkinen/165

And create any number of prices with payment links for your customer or group of customers:

https://mel.store/jehkinen/165?uuid=22503fa3

https://mel.store/jehkinen/165?uuid=a9c28d36

...

🏂 You also can combine payment links with additional fields of product, please refer to

🤖Checkout / Additional Fields

Example of how it can be combined

https://mel.store/jehkinen/165?uuid=a9c28d36&phone_number=%2B35796652117&name=Eva%20Choo

If you don't need a concrete payment link anymore you can remove it

DELETE https://api.mel.store/api/mel-store/:productId/payment-links/:paymentLink

curl --location --request DELETE 
'https://api.mel.store/api/mel-store/products/:productId/payment-links/:paymentLinkId' \
--header 'Authorization: Bearer *****'

If you removed a link successfully you will get

Response 204, No Content

Last updated