Built by

Agilo

Category

Payment

Version

1.0.1

Last updated

Oct 21, 2022, 11:59:04 AM2 years ago

About

Participants

@anteprimorac
@josipmatichr
@marijapolovic

Description

Adds Reepay payment provider for Medusa Commerce.

Set up Project

Install:
npm i @agilo/medusa-payment-reepay
Add to medusa-config.js
{
resolve: `@agilo/medusa-payment-reepay`,
options: {
api_key: REEPAY_API_KEY,
payment_methods: ["mobilepay"],
webhook_secret: WEBOOK_SECRET,
accept_url: "www.some-webshop.com/checkout/payment",
cancel_url: "www.some-webshop.com/checkout",
},
}
Enable reepay as a payment provider in Medusa admin settings

Creating Payment Session

Use Medusa API to create Payment Sessions for the available payment providers.
This will create a Reepay charge session.
Request
{
settle: false,
order: {
handle: CART_ID,
amount: TOTAL,
currency: CURRENCY_CODE,
customer: {
email: CART_EMAIL,
},
},
payment_methods: this.options_.payment_methods,
accept_url: this.options_.accept_url,
cancel_url: this.options_.cancel_url,
}
Response
{
id: "string",
url: "string"
}

Authorize Payment

Use Medusa API to complete cart, this will result in an attempt to authorize payment.
To authorize payment using Reepay checkout you can use
Copy to clipboard
cart.payment_session.data.action.url
to redirect user to the checkout page.
After completion user is redirected to the
Copy to clipboard
options.accept_url
, where you can complete a cart.
If you're using webhooks you should make sure to check that the cart is not already completed to avoid conflict. In this case you should retrieve an order before trying to complete the cart.

Capture Payment

Capturing payment will result in an attempt to settle a payment

Cancel Payment

Canceling an order will result in an attempt to cancel a charge

Refund Payment

Creating a refund will result in an attempt to create a refund

Webhooks

Currently, the only supported webhook is for invoice_authorized.
Once this webhook is fired, this will result in an attempt to complete a cart.

MobilePay

To enable MobilePay payment method you should add a MobilePay acquirer in the Reepay acquiring configuration. After that you should add "mobilepay" as a payment method in the medusa-payment-reepay options.

Resources

Build your own plugins

Develop your own plugins with our API to speed up your processes.

Make your plugin available via npm for it to be shared in our Plugin Library with the broader Medusa community.