Skip to main content

Receive a card payment

Learn how to receive a card payment from your customer.

Card payment is when your customer uses a credit or debit card. To complete a card payment, your customer should enter their card information at checkout.

The card payment flow

At checkout, your customers enter their credit card information. Your customers' experience completing a card payment varies based on different factors. Their card network, issuing bank, and current country are common factors that might affect their experience due to additional security verification steps such as 3DS.

Low-code integration

PayRex offers a low-code solution that gives you more payment integration control.

  • Checkout: This lets you redirect your customers to a PayRex-hosted checkout page.
  • Elements: A UI component that you can embed into your website. When your customer is ready to complete a purchase, you create a PaymentIntent and configure how you want to display payment methods.

Receiving a straight payment

To receive a straight card payment, you must specify that you allow a card payment when creating a payment intent. The example below is for payment intent workflow.

create_payment_intent.js
// Protect your PayRex Secret API key at all costs. One common approach is
// storing it in an environment variable.
// Add your PayRex test secret API key.
const payrexSecretApiKey = '';

const payrex = require('payrex-node')(payrexSecretApiKey);

// Create a PaymentIntent with amount and currency
const paymentIntent = await payrex.paymentIntents.create({
// Amount is in cents. The sample below is 100.00.
amount: 10000,
currency: 'PHP',
payment_methods: [
'card',
// add more payment methods if this is your preference
],
});

const output = {
clientSecret: paymentIntent.clientSecret,
}

console.log(JSON.stringify(output));

Once you specify the card string, PayRex will handle the rest of your customer's payment flow. The card payment form will show if you successfully integrated one of our low-code solutions.