Amount sent to Adyen is wrong unless it has exactly two decimal places (e.g. 10 is charged as 0.10)

Open
#152 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
backend, payments

Research direction

Start by reading the amount conversion in src/main/java/org/killbill/billing/plugin/adyen/client/AdyenSDKClientImpl.java around lines 133–138, then check how sessions, refunds, and purchases use it. Verify the conversion against the CHF examples in the issue, including amounts with zero or more than two decimal places and currencies with different minor units; done means Adyen receives the correct minor-unit value for all three flows.

Written by the indexing model from the issue text.

Description

Description

The plugin converts the Kill Bill amount to Adyen minor units by removing the decimal point from the amount's string form. The result is correct only when the amount has exactly two decimals. Any other scale changes the amount sent to Adyen: 10 is sent as 10 minor units (0.10), and 10.5 as 105 (1.05). Currencies whose minor unit is not 2 decimals (e.g. JPY, KWD) are always converted incorrectly. Checkout sessions, purchases and refunds are affected.

Environment

  • killbill-adyen-plugin 0.10.x (maint-for-0-24-x) and 0.11.0 (master)
  • Kill Bill 0.24.x, Adyen TEST

Steps to reproduce

  1. Create a payment through the plugin with an amount that has no decimals:
    POST /1.0/kb/accounts/{accountId}/payments with {"transactionType":"PURCHASE","amount":10,"currency":"CHF"}
  2. Check the amount on the Adyen side (Customer Area or the AUTHORISATION webhook amount.value).

Expected

Adyen receives amount.value = 1000 (CHF 10.00). Kill Bill and Adyen amounts match.

Actual

Adyen receives amount.value = 10 (CHF 0.10). Kill Bill records 10.00.

Kill Bill amount Sent to Adyen (amount.value) Charged
10.00 1000 10.00
10 10 0.10
10.5 105 1.05
1.000000000 1000000000 10,000,000.00

Evidence

  • Conversion: AdyenSDKClientImpl.java#L133-L138
    String minorUnit = amount.toString().replace(".", "");
    return Long.valueOf(minorUnit);
    
  • Used for:
  • Observed:
    • Local test: a demo-app checkout of 20 was recorded in Kill Bill as 20.00 USD, while the Adyen AUTHORISATION webhook showed amount.value = 20.
Dominant language
Java
Stars
11
Forks
31
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from killbill/killbill-adyen-plugin

All issues in killbill/killbill-adyen-plugin

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.