Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphcommerce/magento-cart-payment-method

Package Overview
Dependencies
Maintainers
0
Versions
678
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphcommerce/magento-cart-payment-method

Defines the API's and building blocks to create payment methods in the checkout.

  • 8.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Magento Payment

Defines the API's and building blocks to create payment methods in the checkout.

Flow

Payment Method module

A Magento Payment Method module must implement PaymentModule

export interface PaymentModule {
  PaymentOptions: React.VFC<PaymentOptionsProps>
  PaymentButton?: React.VFC<PaymentButtonProps>
  expandMethods?: ExpandPaymentMethods
}

Creating a payment method

If a payment method is not implemented it will show a console error No PaymentModule found for method ${code}

1. Create the module

import {
  PaymentMethodOptionsNoop,
  PaymentMethodPlaceOrderNoop,
  PaymentModule,
} from '@graphcommerce/magento-cart-payment-method'

// This is the internal code of the payment method provided by Magento
export const braintree_local_payment = {
  PaymentOptions: PaymentMethodOptionsNoop,
  PaymentPlaceOrder: PaymentMethodPlaceOrderNoop,
} as PaymentModule

2. Register the module

On your payment page (pages/checkout/payment.tsx by default) pass in the payment method into the PaymentMethodContextProvider:

<PaymentMethodContextProvider
  modules={{ ...included_methods, braintree_local_payment }}
>

3. Customize setPaymentMethodOnCart

Open PaymentMethodOptionsNoop and PaymentMethodPlaceOrderNoop for details how it is used.

FAQs

Package last updated on 14 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc