Page MenuHomePhabricator
Paste P58824

Gr4vy proof of concept
ActivePublic

Authored by jgleeson on Mar 19 2024, 9:57 PM.
Tags
None
Referenced Files
F42773307: Gr4vy proof of concept
Mar 19 2024, 9:57 PM
Subscribers
None
<?php
require __DIR__ . '/vendor/autoload.php';
$privateKeyLocation = __DIR__ . "/private_key.pem";
$config = new Gr4vy\Gr4vyConfig("partners", $privateKeyLocation, true, "sandbox");
$checkoutSession = $config->newCheckoutSession();
$token = $config->getEmbedToken([
"amount" => 20,
"currency" => "GBP",
], $checkoutSession["id"]);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Embed POC</title>
<script src="https://cdn.partners.gr4vy.app/embed.latest.js"></script>
</head>
<body>
<form action="/checkout" id="payment-form">
<div class="container"></div>
<input type="submit"/>
</form>
<script>
gr4vy.setup({
gr4vyId: "partners",
element: ".container",
form: "#payment-form",
amount: 20,
currency: "GBP",
country: "GB",
token: '<?php echo $token; ?>',
environment: "sandbox"
});
</script>
</body>
</html>

Event Timeline

jgleeson updated the paste's language from php to html.
jgleeson updated the paste's language from html to php.
jgleeson updated the paste's language from php to html.