Service methods

Introduction

If you use a custom frontend with Magento, the following service methods are provided to interact with the Raylo Pay module via the Magento service layer.

You don't need to use all of them; rather, take the ones that match your particular implementation.

For example, you might only need the following to make the product page widget work:

  • raylopay/meta/widgets/scripturls

  • raylopay/widgets/product/jwt

Similarly, you could also use only these to make the checkout widget work:

  • raylopay/meta/widgets/scripturls

  • raylopay/widgets/checkout/current/jwt

And this one for the checkout redirection URL:

  • raylopay/checkout/current/redirecturl

The additional methods are provided for convenience/adaptability to specific cart or order IDs.

All the service methods return a JSON value that follows the following pattern:

{
    "success": boolean,
    "error": string | null, // null if success is true
    "result": ... | null // null if success is false, specific return type otherwise
}

raylopay/meta/widgets/scripturls

This service method returns the list of script URLs that are required to show the Raylo Pay widgets.

Full URL: https://<domain>/rest/V1/raylopay/meta/widgets/scripturls

Parameters (POST body): {} (none).

Return type:

Example return value:

raylopay/widgets/product/jwt

This service method returns a JWT payload that can be used to display the product page widget.

Full URL: https://<domain>/rest/V1/raylopay/widgets/product/jwt

Parameters (POST body): { "variation_id": string }:

  • variation_id is the ID of the product or product variant to generate the JWT for.

Return type:

Example return value:

raylopay/widgets/checkout/current/jwt

This service method returns a JWT payload that can be used to display the checkout page widget for the current cart in the Magento session.

Full URL: https://<domain>/rest/V1/raylopay/widgets/product/jwt

Parameters (POST body): {} (none).

Return type:

Example return value:

raylopay/widgets/checkout/cart/jwt

This service method returns a JWT payload that can be used to display the checkout page widget for a specific cart from the Magento back-end.

Full URL: https://<domain>/rest/V1/raylopay/widgets/checkout/cart/jwt

Parameters (POST body): { "cartId": number }:

  • cartId is the ID of the cart to generate the JWT for.

Return type:

Example return value:

raylopay/checkout/current/redirecturl

This service method returns the URL that a user should be redirected to in order to complete the checkout of their "current" order - the latest order of the current user session.

Full URL: https://<domain>/rest/V1/raylopay/checkout/current/redirecturl

Parameters (POST body): {} (none).

Return type:

Example return value:

raylopay/checkout/order/redirecturl

This service method returns the URL that a user should be redirected to in order to complete the checkout of a specific order.

Full URL: https://<domain>/rest/V1/raylopay/checkout/order/redirecturl

Parameters (POST body): { "orderId": number }:

  • orderId is the ID of the order to generate the JWT for.

Return type:

Example return value:

raylopay/checkout/current/jwt

This service method returns a JWT payload that can be used to display the checkout page widget for the current cart in the Magento session.

Full URL: https://<domain>/rest/V1/raylopay/checkout/current/jwt

Parameters (POST body): {} (none).

Return type:

Example return value:

raylopay/checkout/order/jwt

This service method returns a JWT payload that can be used to build the checkout redirect URL for a specific order from the Magento back-end.

Full URL: https://<domain>/rest/V1/raylopay/checkout/order/jwt

Parameters (POST body): { "orderId": number }:

  • orderId is the ID of the order to generate the JWT for.

Return type:

Example return value:

Last updated

Was this helpful?