Cannot create payment with amount 0

I have a loyalty program that can sometime create a discount that results in an order of amount 0. When I try to create a payment with amount $0, I get the following error:

Error: Payments API createPayment failed. total requested amount $0 is below the minimum allowed

How should I handle this situation? What’s the correct way to process a payment when the order has been discounted to $0?

In this situation you would need to use PayOrder, and pass an empty array of payment_ids to create a $0 order. Take a look at the link for more information, and let me know if you have any questions.

Thanks @sjosey. The docs for createPayment say that the amount can be positive or negative. Would it be possible to add the exception for amount 0?

I believe that’s a general statement for the Money object, not for CreatePayment specifically. Some endpoints, like the refunds, will be able to have 0 or negative amounts, but you will not be able to create one via the CreatePayment endpoint.

Thanks @sjosey. Another issue: I’ve been using the receipt_url from the create payment response, but if I complete the payment with payOrder, it seems I no longer have access to the receipt. The createPayment response give me a receiptNumber. Can I use that to find the receipt_url somehow?

@sjosey, another question about this. If my order is discounted to $0, but the user still wants to add a tip, I need to be able to create a payment of $0 and add the tip to the tip_money property. But since it’s impossible to create a payment with amount $0, I can’t do that. I could make a special case for this and add the tip to the amount, but that would require a lot of special cases in my application because I’m using the tip_money property a lot. Any thoughts on this case?

Looks like since there is no payment object, there will not be a way to obtain the receipt via the API unfortunately. Technically one does exist (you can see it in the dashboard), it just is not retrievable via the API.

As for your second question: there is no way to add a tip to a $0 payment/order at this time, unfortunately.

Thanks for your help @sjosey. The inability to add tip to a $0 payment is a pretty major issue for my application. Is there a plan to add this ability in the future?

Following back up here, I actually was incorrect, my apologies. Upon testing, you are able to set amount_money to 0 and tip_money to some amount, which does work. Sorry for the confusion here!

@sjosey So it works if tip_money is non-zero, but not if amount_money and tip_money are both 0, correct?

That is correct. If the entire order (including tip) is $0, you should use PayOrder. If your order is $0, but you want to include a tip, you can do that through CreatePayment.

How this $0 order affects to the transaction fees? What fees are applied?

For the original solely $0 order (with no tips), there would be no transaction fees since no money was moved. For the $0 payment with a tip, there would be the usual fees based on the tip amount.