无法以非美元价格创建条带订阅

nhaq1z21  于 2021-06-27  发布在  Java
关注(0)|答案(1)|浏览(238)

我正在尝试设置使用美元,欧元和英镑条纹订阅付款。我有三种价格的产品,每种货币一种。如果我选择美元价格,它可以工作,但订阅创建失败,除了以下例外:
com.stripe.exception.invalidrequestexception:指定的价格使用 eur 与预期的货币不符 usd . 使用 usd 相反
我不明白美元是从哪里来的。创建订阅的代码:

// 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);

有什么想法吗?德克萨斯州。

pu3pd22g

pu3pd22g1#

我在freenode的#stripe上收到了一个答案:

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

30秒之内就恢复了。令人印象深刻的支持。

相关问题