David Tinker
David Tinker

Reputation: 9624

Unable to create Stripe subscription with non-USD price

I am trying to setup subscription payments with Stripe using USD, EUR and GBP. I have one product with 3 prices, one for each currency. If I choose the USD price it works but subscription creation fails for the others with this exception:

com.stripe.exception.InvalidRequestException: The specified price uses eur which doesn't match the expected currency of usd. Use usd instead

I don't understand where it is getting USD from. My code to create the subscription:

// link PaymentMethod to Customer .. might throw CardException
PaymentMethod pm = null;
try {
    pm = PaymentMethod.retrieve(paymentMethodId);
    pm.attach(PaymentMethodAttachParams.builder().setCustomer(customer.getId()).build());
} catch (CardException e) {
    throw new ReportableException(e.getMessage());
}

// make default PaymentMethod for customer
CustomerUpdateParams cup = CustomerUpdateParams.builder()
        .setInvoiceSettings(CustomerUpdateParams.InvoiceSettings.builder().setDefaultPaymentMethod(paymentMethodId).build())
        .build();
customer.update(cup);

SubscriptionCreateParams.Item item = SubscriptionCreateParams.Item.builder().setPrice(price).build();

// create subscription
SubscriptionCreateParams subCreateParams = SubscriptionCreateParams.builder()
        .addItem(item)
        .setCustomer(customer.getId())
        .addAllExpand(Arrays.asList("latest_invoice.payment_intent"))
        .build();

Subscription subscription = Subscription.create(subCreateParams);

Any ideas? Tx.

Upvotes: 1

Views: 503

Answers (1)

David Tinker
David Tinker

Reputation: 9624

I received an answer on #stripe on freenode:

@timebox
A Customer can only have one currency.
You've already created a Subscription on that Customer with USD.

Got that back inside of 30 seconds. Impressive support.

Upvotes: 3

Related Questions