Add method to retrieve receipt credentials for a boost payment

This commit is contained in:
Ehren Kret
2021-10-25 14:54:40 -07:00
parent d27ec6fe8d
commit 090d722b61
5 changed files with 117 additions and 8 deletions

View File

@@ -157,6 +157,20 @@ public class StripeManager {
}, executor);
}
public CompletableFuture<PaymentIntent> getPaymentIntent(String paymentIntentId) {
return CompletableFuture.supplyAsync(() -> {
try {
return PaymentIntent.retrieve(paymentIntentId, commonOptions());
} catch (StripeException e) {
if (e.getStatusCode() == 404) {
return null;
} else {
throw new CompletionException(e);
}
}
}, executor);
}
public CompletableFuture<Subscription> createSubscription(String customerId, String priceId, long level, long lastSubscriptionCreatedAt) {
return CompletableFuture.supplyAsync(() -> {
SubscriptionCreateParams params = SubscriptionCreateParams.builder()