Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql addition #243

Closed

Conversation

shreyas-codes
Copy link

No description provided.

## Razorpay GraphQl Extension

This is the Order Flow for placing Magento Order using razorpay with graphql 

1. set Payment Method on Cart
```
mutation {
  setPaymentMethodOnCart(input: {
      cart_id: "F8MruNi2R7tiZqo8Pkglxaz370VrUnCu"
      payment_method: {
          code: "razorpay"
      }
  }) {
    cart {
      selected_payment_method {
        code
      }
    }
  }
}
```

2. Create Razorpay Order against the cart total(just after the final placeorder button click)
```
mutation {
  createRazorpayOrder (
    cart_id: "F8MruNi2R7tiZqo8Pkglxaz370VrUnCu"
  ){
    success
    rzp_order
    order_id
    amount
    message
  }
}
```

3. Generate Payment from the Frontend/React/using razorpay's checkout.js & obtain razorpay_payment_id & razorpay_signature

4. Save Razorpay Response Details against Cart after payment success 
```
mutation {
  setRzpPaymentDetailsOnCart (
    input: {
      cart_id: "F8MruNi2R7tiZqo8Pkglxaz370VrUnCu"
      rzp_payment_id: "pay_GmVq2o9VzEQkPL"
      rzp_order_id: "order_GmVovQtWtOsquw"
      rzp_signature: "c95c961f7f4682e932f8dfc7d52e87c5f0dff43bce81efa86ad80a7c808983b7"
    }
  ){
  cart{
    id
  }
  }
}
```
5. Finally Place Magento Order 
```
mutation {
  placeOrder(input: {cart_id: "F8MruNi2R7tiZqo8Pkglxaz370VrUnCu"}) {
    order {
      order_number
    }
  }
}
```
@ramth05
Copy link
Contributor

ramth05 commented May 5, 2021

#240 , changes added in base PR.

@ramth05 ramth05 closed this May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants