INVOICE_PAYMENT_FAILED when tax_percentage specified

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
}

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:

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.

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).

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

1 Like