Skip to content

Commit

Permalink
Update currencies in stripe checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
subiabre committed Dec 18, 2023
1 parent d804fc3 commit 3ab2021
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Omnipay/Stripe/Subscription/Message/SubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function sendData($data)
{
$user = $data['user'];
$invest = $data['invest'];

/** @var Project */
$project = $invest->getProject();

$customer = $this->getStripeCustomer($user)->id;
Expand All @@ -58,7 +60,7 @@ public function sendData($data)
[
'price' => $this->stripe->prices->create([
'unit_amount' => $invest->amount * 100,
'currency' => 'eur',
'currency' => $project->currency,
'recurring' => ['interval' => 'month'],
'product' => $this->getStripeProduct($invest)->id
])->id,
Expand Down Expand Up @@ -90,7 +92,7 @@ public function completePurchase(array $options = [])
return new SubscriptionResponse($this, $session->id);
}

$checkout = $this->stripe->checkout->sessions->create([
$donation = $this->stripe->checkout->sessions->create([
'customer' => $this->getStripeCustomer(User::get($metadata['user']))->id,
'success_url' => sprintf('%s?session_id={CHECKOUT_SESSION_ID}', $this->getRedirectUrl(
'invest',
Expand All @@ -104,7 +106,7 @@ public function completePurchase(array $options = [])
[
'price' => $this->stripe->prices->create([
'unit_amount' => $metadata['donate_amount'] * 100,
'currency' => 'eur',
'currency' => Config::get('currency'),
'product_data' => [
'name' => Text::get('donate-meta-description')
]
Expand All @@ -115,7 +117,7 @@ public function completePurchase(array $options = [])
'metadata' => $metadata
]);

return new DonationResponse($this, $checkout->id);
return new DonationResponse($this, $donation->id);
}

if ($session->payment_intent) {
Expand Down

0 comments on commit 3ab2021

Please sign in to comment.