Shopify / mobile-buy-sdk-android

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using their credit card.
MIT License
214 stars 136 forks source link

Checkout complete free isn't working (for Cash on delivery) #581

Closed MuhammadMuzammilSharif closed 5 years ago

MuhammadMuzammilSharif commented 5 years ago

I am trying to buy products using Cash On Delivery payment method but when I try to implement code below it always throw an error that "Payment is required" while the Cash On Delivery Payment Method is enabled from admin side.

val mutationQuery = Storefront.mutation { mutationQuery ->
    mutationQuery.checkoutCompleteFree(checkoutId) { checkoutCompleteQuery ->
        checkoutCompleteQuery
                .userErrors { userErrorQuery ->
                    userErrorQuery
                            .message()
                            .field()
                }.checkout { checkoutQuery ->
                    checkoutQuery
                            .ready()
                            .note()
                }
    }
}
val graphClient = ...
graphClient.mutateGraph(mutationQuery).enqueue(object : GraphCall.Callback<Storefront.Mutation> {
    override fun onFailure(error: GraphError) {
        Log.e("ERROR", error.toString())
    }

    override fun onResponse(response: GraphResponse<Storefront.Mutation>) {
        Log.d("Response", response.toString())
    }
})
rebeccajfriedman commented 5 years ago

We currently don't support manual payments (such as cash on delivery) in the Storefront API. The .checkoutCompleteFree mutation is used only for completing a checkout that doesn't cost anything - it must be free.

We are tracking this issue in our backlog. Sorry for the inconvenience.

venkataseshaiahudatha commented 5 years ago

We are also in same situation. We have this feature available in desktop and Mobile web and not able to achieve it in Mobile app. It would be great If you get this feature nearby.

Do you have any plan to expose this feature in mobile SDK. When can we expect the same.

rebeccajfriedman commented 5 years ago

We definitely have plans to expose this functionality, although I don't have a timeline for you yet.

RatulSaha commented 5 years ago

@rebeccajfriedman any followup on this?

rebeccajfriedman commented 5 years ago

Unfortunately, we haven't been able to add this functionality yet. Sorry for the delay!

RatulSaha commented 5 years ago

@rebeccajfriedman Thank you for the response. Just to confirm, there is no way for programmatically create an order with manual payment method?

rebeccajfriedman commented 5 years ago

Not at this time using the Storefront API. You could use the Admin API to create a draft order. Draft orders can be paid with COD.

See mutations list for Admin API: https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/draftordercreate

RatulSaha commented 5 years ago

Many thanks for the direction, appreciate it! Just the last followup question: when you say "Draft orders can be paid with COD", can you point to the mutation that works with that? I shuffled through draftOrderComplete and a few others, but none mentions manual payments as an option.

rebeccajfriedman commented 5 years ago

I ahven't tried this programmatically, but I would suggest sending paymentPending: false

Weakky commented 4 years ago

Hey 👋, it seems like using the Admin API from a user-land app is terribly unsafe. Even if we restrict the API key to only mess with orders, if someone ever gets that API key, he'll be free to create/delete/update any order.

Aren't there any solutions/safer workarounds?

RatulSaha commented 4 years ago

Yes, you should never use admin API in the frontend. And yes there is a way.

You create your own backend that connects to Shopify. From your frontend, you talk to your backend for orders.

Terrible, I know. I just implemented this and it will take a lot of your time. :-)

On Fri, Sep 27, 2019, 12:20 AM Flavian Desverne notifications@github.com wrote:

Hey 👋, it seems like using the Admin API from a user-land app is terribly unsafe. Even if we restrict the API key to only mess with orders, if someone ever gets that API key, he'll be free to create/delete/update any order.

Aren't there any solutions/safer workarounds?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Shopify/mobile-buy-sdk-android/issues/581?email_source=notifications&email_token=ABCB4B2NTOIMYMUZK2NBEEDQLTONBA5CNFSM4GFKZII2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7WEYXQ#issuecomment-535579742, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCB4B42RGRQJW3DITW4BU3QLTONBANCNFSM4GFKZIIQ .

AhmedAwaisS commented 2 years ago

Does it fixed now? I am also having same issue in this mutation. checkoutCompleteFree error "Payment is required"

singhs020 commented 2 years ago

@rebeccajfriedman any update on this? Is there a way we can upvote it or track its availability in storefront API? In India Cash on Delivery is a major option and Shopify support it via an official app as well.

ntelkedzhiev commented 1 year ago

Any update on this? It is a much needed feature...

fabioportieri commented 11 months ago

bump, also in italy COD is very popular and from what i'm understanding there is no way to create a legit order / checkout with cod payment ?

fabioportieri commented 10 months ago

Not at this time using the Storefront API. You could use the Admin API to create a draft order. Draft orders can be paid with COD. You could use the Admin API to create a draft order. Draft orders can be paid with COD.

Actually, i tried this, and it is not feasible because we don't have a way to retrieve the payment gateway id from the shopify api! Works only for manual payments.