Medusa won the Golden Kitty Award for Best Ecommerce Product ✨  Learn More

Medusa Logo
  • Developers
  • Blog
  • Pricing
  • Community
  • About
  • Careers
  • Get Started
  • Developers
  • Blog
  • Pricing
  • Community
  • About
  • Careers
  • Get Started
Browse

Built by

Agilo

Category

Payment

Version

1.0.1

Last updated

Oct 21, 2022, 11:59:04 AM5 months ago
View sourceView on NPMCopy link

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 cart.payment_session.data.action.url to redirect user to the checkout page.

After completion user is redirected to the 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

Medusa Docs\ https://docs.medusajs.com/

Reepay Docs\ https://reference.reepay.com/api/

MobilePay Docs\ https://developer.mobilepay.dk/products/online/test

altText of the image

Build your own plugins

Take Medusa up another level, and develop your own plugins with our API to speed up your processes.

Focus on building plugins for tools you use in your daily workflow, and publish to the Medusa Plugin Store for others to install.

Read more
altText of the image
Medusa

Product

Medusa for B2BIntegrationsGet StartedCareers
We're hiring

Developers

DocsAPI ReferencesCommunityDiscussions

Medusa

BlogPricingAboutContact Us

Newsletter

Get a summary of what we’ve shipped during the last month, behind the scenes updates, and team picks. Unsubscribe any time.

© 2023 MedusaJS, Inc.