We have a "free sample" product we need to implement. If this is the only product that is in the cart/basket, the shipping total will be $0 and taxes will be $0. Since we don't need to charge the customer, we skip the CC info step, and we have that all wired up, but I'm having trouble figuring out a way to open the order/invoice without calling preparation.AuthorizeCapturePayment().
Things I've tried:
* Calling preparation.AuthorizeCapturePayment with just the paymentMethodKey. This bombs out, likely because it's expecting certain arguments that are missing (CC info)
* Calling preparation.PrepareInvoice(). This creates the invoice, but the invoice appears as "Unpaid" in the dashboard.
You could enable the cash provider, not offer it as a payment method in your UI and then apply (AuthorizeCapture) a cash payment of $0. Would that do it?
@Rusty I enabled the Cash provider, but GetPaymentGatewayMethods() is still returning only Stripe. Tried touching web.config, and still no dice. Any ideas?
Edit: My apologies. I enabled the provider, but didn't add the method :/
@Biagio We no longer have the code in our project, as we removed the promotional functionality that caused the order balance to be $0. However, we just needed to enable and configure the cash provider, and when we loaded the payment screen, we bypassed credit card info if balance <= $0 (and display the order summary with something like "Click continue to complete your order"). Then when that page was submitted, we would again check the balance - if $0, then use the cash provider.
Opening an order with a $0 balance
We have a "free sample" product we need to implement. If this is the only product that is in the cart/basket, the shipping total will be $0 and taxes will be $0. Since we don't need to charge the customer, we skip the CC info step, and we have that all wired up, but I'm having trouble figuring out a way to open the order/invoice without calling preparation.AuthorizeCapturePayment().
Things I've tried:
* Calling preparation.AuthorizeCapturePayment with just the paymentMethodKey. This bombs out, likely because it's expecting certain arguments that are missing (CC info)
* Calling preparation.PrepareInvoice(). This creates the invoice, but the invoice appears as "Unpaid" in the dashboard.
Is there any way to accomplish this?
You could enable the cash provider, not offer it as a payment method in your UI and then apply (AuthorizeCapture) a cash payment of $0. Would that do it?
@Rusty Good idea - I'll give that a shot.
@Rusty I enabled the Cash provider, but GetPaymentGatewayMethods() is still returning only Stripe. Tried touching web.config, and still no dice. Any ideas?
Edit: My apologies. I enabled the provider, but didn't add the method :/
Everything appears to have worked. Thanks again.
How have you done? Could you share the code with other peoples, please?
@Biagio We no longer have the code in our project, as we removed the promotional functionality that caused the order balance to be $0. However, we just needed to enable and configure the cash provider, and when we loaded the payment screen, we bypassed credit card info if balance <= $0 (and display the order summary with something like "Click continue to complete your order"). Then when that page was submitted, we would again check the balance - if $0, then use the cash provider.
Awesome! Thanks for letting me know you got it.
is working on a reply...