peachpayments/magento2-graphql-plugin
最新稳定版本:1.0.2
Composer 安装命令:
composer require peachpayments/magento2-graphql-plugin
包简介
PeachPayments Hosted module, for Magento 2 GraphQl support.
README 文档
README
Installation
Install this module alongside the Peach Payments hosted payments module by running:
composer require peachpayments/magento2-graphql-plugin
GraphQL
To allow for a GraphQL flow, use the core Magento setPaymentMethodOnCart and placeOrder methods.
After a successful order ID has been returned, use the getPeachHostedRedirectUrl method to redirect the customer to the Checkout page. At this stage, the order should be in the pending state. Deconstruct the JSON object from form_data and submit it as _POST parameters to the specified form_link URL.
After the customer has returned to the return_url you specified, call the getPeachHostedOrderStatus method to get a success (1) or declined (2) status. If the status code is 3, retry regularly.
Examples
# Set Peach Payments as payment method
mutation setPaymentMethodOnCart($cartId: String!){
setPaymentMethodOnCart(input: {
cart_id: $cartId
payment_method: {
code: "peachpayments_hosted_card"
}
}) {
cart {
selected_payment_method {
code
}
}
}
}
# Place order
mutation placeOrder($cartId: String!) {
placeOrder(input: {cart_id: $cartId}) {
order {
order_number
}
}
}
# Get redirect URL and data
query getPeachHostedRedirectUrl($cartId: String!){
getPeachHostedRedirectUrl(input: {
cart_id: $cartId,
return_url: "https://my.app.pwa/payment/welcome-back.html"
}) {
form_data
form_link
}
}
# Get status by order increment ID
query getPeachHostedOrderStatus($orderNumber: String!){
getPeachHostedOrderStatus(input: { order_number: $orderNumber }) {
status
}
}
# Get order details, used for confirmation page
query getPeachHostedOrderDetailsData($cartId: String!) {
getPeachHostedOrderDetailsData(cart_id: $cartId) {
id
...OrderConfirmationPageFragment
}
}
统计信息
- 总下载量: 12.27k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2023-04-17