Skip to content

Creating Payment cards

Receiving payments with payment cards

Payment cards in Tropipay are a convenient and flexible way for businesses to accept payments online. This concept is often called payment links. Instead of integrating a complex payment system into a website or app, payment cards allow merchants to generate unique URLs that customers can click to make payments. Payment Links can be customized to include details such as product descriptions, reference, and amounts. This allows businesses to create a tailored payment experience for their customers.

Generating a payment card

/*
* Example Payload
*/
const payload = {
reference: "my-paylink-1",
concept: "Bicycle",
favorite: "true",
amount: 3000,
currency: "EUR",
description: "Two wheels",
singleUse: "true",
reasonId: 4,
// expirationDays means that user can get refund on his payment
// funds wont be available in the merchant account until expirationDays is over
// pass 0 for no expirationDays, means no refund is possible for this paymentcards
expirationDays: 1,
lang: "es",
urlSuccess: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
urlFailed: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
urlNotification: "https://webhook.site/680826a5-199e-4455-babc-f47b7f26ee7e",
serviceDate: "2021-08-20",
// client data is optional, you can pass client: null
// but if you pass client data, must pass at least email
client: {
name: "John",
lastName: "McClane",
address: "Ave. Guadí 232, Barcelona, Barcelona",
phone: "+34645553333",
email: "client@email.com",
countryId: 1,
termsAndConditions: "true",
},
directPayment: "true",
// (optional) paymentcard image
imageBase: "data:image/png;base64,EeVVOFdffd...",
};
// Use inside an async function
const paylink = await tpp.paymentCards.create(payload);
console.log(paylink.shortUrl);

Further reading

Please refer to the Official Payment cards Documentation