Skip to content

Commit

Permalink
Add more comments in samples
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-zijdemans-vipps committed Dec 12, 2023
1 parent 3c7f33e commit 1ff11fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion sample_code/checkout_sample.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import "https://deno.land/[email protected]/dotenv/load.ts";
import { Client } from "https://deno.land/x/[email protected]/mod.ts";

// Read environment variables
// First, get your API keys from https://portal.vipps.no/
// Here we assume they are stored in a .env file, see .env.example
const clientId = Deno.env.get("CLIENT_ID") || "";
const clientSecret = Deno.env.get("CLIENT_SECRET") || "";

Expand All @@ -16,6 +17,7 @@ const client = Client({
retryRequests: false,
});

// Create a checkout session
const checkout = await client.checkout.create(clientId, clientSecret, {
merchantInfo: {
callbackUrl: "https://example.com/callbackUrl",
Expand All @@ -30,6 +32,7 @@ const checkout = await client.checkout.create(clientId, clientSecret, {
},
});

// Check if the checkout session was created successfully
if (!checkout.ok) {
console.error("😟 Error creating checkout session 😟");
console.log(checkout.error);
Expand Down
3 changes: 2 additions & 1 deletion sample_code/epayment_sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { open } from "https://deno.land/x/[email protected]/index.ts";
import "https://deno.land/[email protected]/dotenv/load.ts";
import { Client } from "https://deno.land/x/[email protected]/mod.ts";

// Read environment variables
// First, get your API keys from https://portal.vipps.no/
// Here we assume they are stored in a .env file, see .env.example
const clientId = Deno.env.get("CLIENT_ID") || "";
const clientSecret = Deno.env.get("CLIENT_SECRET") || "";

Expand Down
3 changes: 2 additions & 1 deletion sample_code/webhook_sample.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import "https://deno.land/[email protected]/dotenv/load.ts";
import { Client } from "https://deno.land/x/[email protected]/mod.ts";

// Read environment variables
// First, get your API keys from https://portal.vipps.no/
// Here we assume they are stored in a .env file, see .env.example
const clientId = Deno.env.get("CLIENT_ID") || "";
const clientSecret = Deno.env.get("CLIENT_SECRET") || "";

Expand Down

0 comments on commit 1ff11fd

Please sign in to comment.