Get Payment

The Get Payment endpoint allows you to get the details and status of any payment, using the ID of the payment.

We recommend your store the payment ID in your database when you create a payment

HTTP request

Get a payment

GET https://api.piecard.app/payment/:paymentId

Path Parameters

NameTypeDescription

paymentId*

string

The unique ID of the payment. This is returned when the payment is created.

{
    success: true,
    payment: {
        _id,
        amount,
        fee,
        memo,
        payee, // your Pi eCard username
        metadata,
        successURL,
        cancelURL,
        sandbox
    }
}

Usage with NPM Package

// Get payment
const paymentId = STRING // 63e064aebc26563e677a9ae1
piecard.getPaymentById(paymentId)
  .then((response) => {
    console.log("Get payment : ", response);
  })
  .catch((err) => {
    console.log("Get payment error : ", err);
  });

Example using Axios

const id = 'YOUR_PAYMENT_ID';
const response = await axios
    .get(`https://api.piecard.app/payment/${id}`, {
        headers: {
            clientid: "YOUR_CLIENT_ID",
            clientsecret: "YOUR_CLIENT_SECRET",
            accesstoken: "YOUR_ACCESS_TOKEN"
        }
    });

Last updated