# INVOICE\_PAYMENT\_FAILED when tax\_percentage specified

**URL:** https://community.rapyd.net/t/invoice-payment-failed-when-tax-percentage-specified/502
**Category:** 🙋🏽‍♀️🙋🏽‍♂️ Ask Questions
**Created:** [June 20, 2021, 1:00am UTC](https://community.rapyd.net/t/invoice-payment-failed-when-tax-percentage-specified/502 "2021-06-20T01:00:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![abo](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/abo/32/906_2.png) [@abo](https://community.rapyd.net/u/abo)
#### Post date: [June 20, 2021, 1:00am UTC](https://community.rapyd.net/t/invoice-payment-failed-when-tax-percentage-specified/502/1 "2021-06-20T01:00:51Z")

</div>

For currencies without any decimal places (e.g. ISK), specifying a tax\_percentage = 24 in ‘Create Subscription’ caused the subscription to fail later on.

Notice that the total field in the response has a decimal number in it.

{“id”:“wh\_d062c6a8a34856eaf70f81b79e52ce25”,“type”:“INVOICE\_PAYMENT\_FAILED”,“data”:{“id”:“invoice\_4b4c9ee2bb5e2456972252622b2436f6”, **“tax”:4797.6** ,“type”:“payment”,“lines”:[{“id”:“il\_271f2bcce18faf03e10d664aa564ad77”,“plan”:{“id”:“plan\_7e018e6a03622f5e441a3a7a9459469f”,“tiers”:, **“amount”:19990** ,“currency”:“ISK”,“interval”:“month”,“metadata”:{},“nickname”:"",“created\_at”:1623531132,“tiers\_mode”:"",“usage\_type”:“licensed”,“billing\_scheme”:“per\_unit”,“interval\_count”:1,“aggregate\_usage”:“sum”,“transform\_usage”:{“round”:“up”,“divide\_by”:1},“trial\_period\_days”:0},“type”:“subscription”,“amount”:19990,“period”:{“end”:1626740259,“start”:1624148259},“currency”:“ISK”,“metadata”:{},“quantity”:1,“proration”:false,“description”:“Áskrift að …”,“discountable”:true,“invoice\_item”:"",“subscription”:“sub\_55afcb592f05e027ae1b6163e55bd8b6”,“subscription\_item”:“subi\_3c7a85716e4709495bb33af551e904a8”}], **“total”:24787.6** ,“number”:0,“payout”:null,“status”:“open”,“billing”:“pay\_automatically”,“payment”:null,“currency”:“ISK”,“customer”:“cus\_2bca62723eb95e65998b94d9a34ca00d”,“discount”:null,“due\_date”:1626740259,“metadata”:{},“subtotal”:19990,“period\_end”:1626740259,“description”:"",“ **tax\_percent":24** ,“period\_start”:1624148259,“subscription”:“sub\_55afcb592f05e027ae1b6163e55bd8b6”,“attempt\_count”:1,“payout\_fields”:null,“billing\_reason”:“subscription\_create”,“days\_until\_due”:30,“payment\_fields”:null,“statement\_descriptor”:”"},“trigger\_operation\_id”:“d6d7f1b2-d515-4900-8cb9-5dbd6231c4c4”,“status”:“NEW”,“created\_at”:1624148459}

What I’d expect should happen is that the number should be rounded to the nearest integer.

create subscription request that fails:

{  
“customer”: “cus\_2bca62723eb95e65998b94d9a34ca00d”,  
“billing”: “pay\_automatically”,  
“days\_until\_due”: 0,  
“cancel\_at\_period\_end”: false,  
“subscription\_items”: [  
{  
“plan”: “plan\_7e018e6a03622f5e441a3a7a9459469f”,  
“quantity”: 1  
}  
],  
“tax\_percent”: 24  
}

---

<div class="post-metadata">

### Author: ![Legato](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/legato/32/41_2.png) [@Legato](https://community.rapyd.net/u/Legato)
#### Post date: [June 20, 2021, 7:52am UTC](https://community.rapyd.net/t/invoice-payment-failed-when-tax-percentage-specified/502/2 "2021-06-20T07:52:40Z")

</div>

Hi,  
Thank you for pointing out this unique use case. There may be an issue with this specific subscription use case where both a currency that does not support decimal places and a tax rate is defined. Note that for regular payments a round down is made as shown in this method that I just ran:

```auto
curl --location --request POST 'https://sandboxapi.rapyd.net/v1/payments' \
{
    "amount": 2600.49,
    "currency": "ISK",
    "merchant_reference_id": "first",
    "payment_method": {
        "type": "is_visa_card",
        "fields": {
            "number": "4111111111111111",
            "expiration_month": "11",
            "expiration_year": "21",
            "cvv": "123",
            "name": "John Doe"
        }
    },
    "ewallets": [
        {
            "ewallet": "ewallet_b9ac422ff97dfb2e9aff263998603b17",
            "percentage": 100
        }
    ],
    "metadata": {
        "merchant_defined": "created"
    },
    "capture": true
}'
{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "9716b75b-de80-47d1-b9a2-8ef5ab654f0a"
    },
    "data": {
        "id": "payment_281a494d81581027ad4a83bcf4b81e8c",
        "amount": 0,
        "original_amount": 2600,
        "is_partial": false,
        "currency_code": "ISK",
        "country_code": "is",
        "status": "ACT",
        "description": "",
        "merchant_reference_id": "first",
        "customer_token": "cus_ff6693f5f194578c2ae8ba767f79aa76",
        "payment_method": "card_ff6173797e32d9be6c0991a6dabd77b2",
        "payment_method_data": {
            "id": "card_ff6173797e32d9be6c0991a6dabd77b2",
            "type": "is_visa_card",
            "category": "card",
            "metadata": null,
            "image": "",
            "authentication_url": "",
            "webhook_url": "",
            "supporting_documentation": "",
            "name": "John Doe",
            "last4": "1111",
            "acs_check": "unchecked",
            "cvv_check": "unchecked",
            "bin_details": {
                "brand": null,
                "bin_number": "411111"
            },
            "expiration_year": "21",
            "expiration_month": "11",
            "fingerprint_token": "ocfp_233d7fb5d4ab11ea95b9121ff706f893"
        },
        "expiration": 1624779677,
        "captured": true,
        "refunded": false,
        "refunded_amount": 0,
        "receipt_email": "",
        "redirect_url": "https://sandboxdashboard.rapyd.net/3ds-payment?token=payment_281a494d81581027ad4a83bcf4b81e8c",
        "complete_payment_url": "",
        "error_payment_url": "",
        "receipt_number": "",
        "flow_type": "",
        "address": null,
        "statement_descriptor": "Rapyd",
        "transaction_id": "",
        "created_at": 1624174877,
        "metadata": {
            "merchant_defined": "created"
        },
        "failure_code": "",
        "failure_message": "",
        "paid": false,
        "paid_at": 0,
        "dispute": null,
        "refunds": null,
        "order": null,
        "outcome": null,
        "visual_codes": {},
        "textual_codes": {},
        "instructions": {},
        "ewallet_id": "ewallet_b9ac422ff97dfb2e9aff263998603b17",
        "ewallets": [
            {
                "ewallet_id": "ewallet_b9ac422ff97dfb2e9aff263998603b17",
                "amount": 2600,
                "percent": 100,
                "refunded_amount": 0
            }
        ],
        "payment_method_options": {},
        "payment_method_type": "is_visa_card",
        "payment_method_type_category": "card",
        "fx_rate": 1,
        "merchant_requested_currency": null,
        "merchant_requested_amount": null,
        "fixed_side": "",
        "payment_fees": null,
        "invoice": "",
        "escrow": null,
        "group_payment": "",
        "cancel_reason": null,
        "initiation_type": "customer_present",
        "mid": "",
        "next_action": "3d_verification"
    }
}

```

For your specific sandbox use case, which I assume is related to the hackathon, I suggest to initially use a currency that supports decimal places.

---

<div class="post-metadata">

### Author: ![abo](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/abo/32/906_2.png) [@abo](https://community.rapyd.net/u/abo)
#### Post date: [June 21, 2021, 12:03am UTC](https://community.rapyd.net/t/invoice-payment-failed-when-tax-percentage-specified/502/3 "2021-06-21T00:03:57Z")

</div>

Thank you Legato for the reply. This is not related to the hackathon actually so changing the currency is not really an option… I wonder how the procedure for bugfixing is for these kind of cases (and timeframe).

---

<div class="post-metadata">

### Author: ![Legato](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/legato/32/41_2.png) [@Legato](https://community.rapyd.net/u/Legato)
#### Post date: [June 21, 2021, 7:14am UTC](https://community.rapyd.net/t/invoice-payment-failed-when-tax-percentage-specified/502/4 "2021-06-21T07:14:48Z")

</div>

If this is a production matter and you are a customer of Rapyd, then please also contact support as they may be able to provide a workaround workflow for you until this is fixed. In any case, a ticket has been opened for this matter. I cannot promise a specific timeframe at this time, but will update you when the matter has been addressed.

Thanks
