OmniPay

Making a payment
Checking if a payment was made or refunded via ID
Paying installments
Withdrawing Revenues
Last updated

Last updated
function makePayment(
string memory _id, // payment ID, must not be a duplicate
uint256 _amount, // amount due in wei
address _vendor, // vendor address
bool _isInstallments, // true if payment is a downpayment with installments
uint256 _fullAmount, // if is installments place the full amount due here, use _amount if full payment (in wei)
uint8 _installmentPeriod // how many months the installment period is max is 120
) external payable;IPayments99 public omnipay = IPayments99(0xEe47e2484342eA7Bcf13B9e6d4F9d53B28F1b724); // address on Avalanche C-Chainuint256 public feePerPayment = omnipay.feePerPayment();uint256 public _amount = 1 * 10 ** 15;
omnipay.makePayment{value: feePerPayment + _amount}(
'ID1', // payment ID, must not be a duplicate
_amount, // amount due in wei
address(0x6BF6D002b5140b7CE0A0a4993621ecE52271e5f0), // vendor address
false, // true if payment is a downpayment with installments
_amount, // if is installments place the full amount due here, if not use _amount (in wei)
0 // how many months the installment period is max is 120
);struct Payment {
string id; // payment ID
uint256 amount; // amount due in Wei
address customer; // customer address
address vendor; // vendor address
bool isPaid; // true if the payment exists and has been paid
bool isRefunded; // true if the payment was refunded
bool isInstallments; // true if the payment contains installments
uint256 fullAmount; // the full amount of the payment
uint256 amountPerInstallment; // amount due per month
uint8 installmentPeriod; // the installment period in months
uint8 paidInstallments; // how many installments have been paid
uint8 remainingInstallments; // how many installments remain
uint256 datePaid; // date the payment was made
uint256 dateLastInstallmentPaid; // date the last installment was paid
}IPayments99 public omnipay = IPayments99(0xEe47e2484342eA7Bcf13B9e6d4F9d53B28F1b724);
IPayments99.Payment public payment = omnipay.lookupPayment('ID1');
bool public isPaid = payment.isPaid == true; // check if paid
bool public isRefunded = payment.isRefunded == true; // check if refundedIPayments99 public omnipay = IPayments99(0xEe47e2484342eA7Bcf13B9e6d4F9d53B28F1b724);
IPayments99.Payment public payment = omnipay.lookupPayment('ID1');
uint256 public feePerInstallment = omnipay.feePerInstallment();
uint256 public amountPerInstallment = payment.amountPerInstallment;
omnipay.payInstallment{value: amountPerInstallment + feePerInstallment}('ID1');IPayments99 public omnipay = IPayments99(0xEe47e2484342eA7Bcf13B9e6d4F9d53B28F1b724);
IPayments99.Payment public payment = omnipay.lookupPayment('ID1');
uint256 public feePerInstallment = omnipay.feePerInstallment();
uint256 public paidSoFar = payment.paidInstallments * payment.amountPerInstallment;
uint256 public installmentAmount = payment.fullAmount - paidSoFar;
omnipay.payInstallment{value: installmentAmount + feePerInstallment}('ID1');IPayments99 public omnipay = IPayments99(0xEe47e2484342eA7Bcf13B9e6d4F9d53B28F1b724);
omnipay.withdrawBalance(1 * 10 ** 15);