GraphQL module

magento2_graphql_icon

Introducing Buckaroo's revolutionary GraphQL extension for the Buckaroo Magento 2 Payments Plugin—an essential enhancement for our cutting-edge Hyvä React checkout extension. GraphQL is a powerful query language for APIs, providing a comprehensive and understandable description of your API's data. Clients can request exactly what they need, optimizing performance and enabling easy API evolution over time. Unlock new e-commerce efficiency and flexibility with Buckaroo's latest innovation. Upgrade your online business experience today!



Requirements

To use the plugin you must use:

  • Magento Open Source version 2.4.x
  • Buckaroo Magento 2 Payment plugin v1.43.0 or higher.
Download

Installation

  1. Install the module using Composer:
composer require buckaroo/magento2graphql
  1. Enable the module:
php bin/magento module:enable Buckaroo_Magento2Graphql
  1. Apply database updates:
php bin/magento setup:upgrade
  1. Flush the cache:
php bin/magento cache:flush

Usage

Example Requests

Get the available payment methods with additional data for gateways:

query {
    cart(cart_id: "{ CART_ID }") {
        available_payment_methods {
            code
            title
            buckaroo_additional {
                key
                values {
                    name
                    code
                    img
                }
                value
            }
        }
    }
}

Place Order Request Example:

To place an order, you will need to do the following 3 steps:

  1. Set the payment method on the cart with the required additional parameters using the default setPaymentMethodOnCart and the buckaroo_additional property.
  2. Set the return URL using our custom migration setBuckarooReturnUrl required for the payment engine to redirect back to your application after the payment was completed/cancelled/failed.
  3. Finally, execute the default placeOrder that will return a redirect URL for the payment engine to complete the payment.

For iDEAL, we have the following example:

mutation doBuckarooPayment(
  $cartId: String!
  $returnUrl: String!
  $methodCode: String!
) {
  setPaymentMethodOnCart(
    input: {
      cart_id: $cartId
      payment_method: {
        code: $methodCode
        buckaroo_additional: { buckaroo_magento2_ideal: { issuer: "ABNANL2A" } }
      }
    }
  ) {
    cart {
      items {
        product {
          name
          sku
        }
      }
    }
  }
  setBuckarooReturnUrl(input: { return_url: $returnUrl, cart_id: $cartId }) {
    success
  }
  placeOrder(input: { cart_id: $cartId }) {
    order {
      order_number
      buckaroo_additional {
        redirect
        transaction_id
        data {
          key
          value
        }
      }
    }
  }
}

After this migration is performed, you will need to store the buckaroo transaction_id and redirect the user to complete the payment.


Retrieve the Payment Status

To get the payment status after the user is redirected back, we will use our custom migration buckarooPaymentTransactionStatus that will need the stored transaction_id.

mutation buckarooPaymentTransactionStatus(input: { transaction_id: "E397CF4C24E64AA299F45246F9906F45" }) {
  payment_status,
  status_code
}

Get the available payment methods with additional data for gateways

query {
    cart(cart_id: "{ CART_ID }") {
        available_payment_methods {
            code
            title
            buckaroo_additional {
                key
                values {
                    name
                    code
                    img
                }
                value
            }
        }
    }
}