Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change amount dynamically problem #48

Open
digitalideafi opened this issue Jul 18, 2024 · 0 comments
Open

Change amount dynamically problem #48

digitalideafi opened this issue Jul 18, 2024 · 0 comments

Comments

@digitalideafi
Copy link

Hi, in a php file I create a checkout service with let's say 10€, then I mount the SumUpCard using javascript call (in the same page) with parameters "amount: 50", "currency: EUR" and "locale: it-IT". In the widget, the submit button text is "Pay 10€" but if I make the payment I will pay 50€.
Why the button text do not change? I tried to use showAmount=false but nothing changed.

PHP

$sumup = new SumUp(array(
        'app_id'     	=> "XXXXX,
        'app_secret' => "YYYYY
        'grant_type' => 'client_credentials',
        'scopes'	=> array('payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly'),
));
$returnURL         = "my return url";
$accessToken 	= $sumup->getAccessToken();
$value 			= $accessToken->getValue();
$ckoutsService = $sumup->getCheckoutService();
 $response 	= $ckoutsService ->create(10, "EUR", $value, 'matchenjoy-test@sumup.com', "some text",
          null, $returnURL, "M4FGYHE4", $returnURL);
$checkoutId     = $response->getBody()->id;

JS

currSumUpCARDPren = SumUpCard.mount({
	id: 'sumup-card',
	checkoutId: <?php echo $checkoutId ?>,
	locale: "it-IT",
	currency: "EUR",
	amount: 50,
	showAmount: false,
        onLoad: function() { },
        onResponse: function(type, body) {...}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant