Skapa testkonto

Integrera Swish
på 5 minuter

Behöver du integrera Swish i en app eller på webben? BankSignering hanterar certifikat, orderbekräftelser och bokföring. Du får ett API som är:

Driftsäkert
Snabbt
Enkelt



Payment Widget API

Ett driftsäkert, snabbt och enkelt API för att integrera Swish


Mycket enkel integration - JSON REST-API med callback till er sajt vid genomförd transaktion

Widget för betalning där QR-kod och direklänk är implementerat

Brandad orderbekräftelse via mail eller SMS till er och kunden

Vidarebefordran av korrekta bokföringsunderlag till Fortnox, Visma, Bokio etc

Inga virtuella maskiner eller certifikatshantering = sparad tid

Integrerad testapp - du behöver inte sätta upp test-BankID och test-Swish

Dedikerad supporttekniker

Driftsäker, snabb och säker hantering av anrop och data


Klicka här för beskrivning av endpoints

Behöver ni integrera Swish i ert system? Vårt API är enkelt, säkert och mycket snabbt att integrera - en erfaren programmerare bör kunna genomföra en transaktion inom 5 minuter, oavsett programmeringsspråk.

API:t har tre endpoints:

1) CreatePayment: Används för att starta en betalningsprocess. Du skickar in data om betalningen och en post payment-url, och får tillbaka en url till en widget där betalningen kan ske. När betalningen är genomförd, misslyckad eller avbruten skickas användaren vidare till din post payment-url, och du kan hämta info om betalningen via PaymentInfo-endpointen. En orderbekräftelse skickas även till kunden och dig.

2) PaymentInfo: Används för att hämta info om en betalningsprocess. Du skickar in betalningens ID från CreatePayment-endpointen och får info om betalningen är genomförd, misslyckad eller avbruten. Rekommendationen är att göra PaymentInfo-anropet när kunden vidarebefordrats till din post payment-url.

3) Refund: Används för att återkalla ett köp eller delar av ett köp. Ange betalningens ID och specifiera vad i betalningen som ska återkallas.

Nedan följer exempelkod med förklaringar av vilken data som krävs. Kontakta oss gärna om du vill veta mer!






1) CreatePayment (POST)


CreatePayment endpoint JSON:
{
"apiKey": "xxx",
// String - API key given by BankSignering

"postPaymentUrl" : "https://example.com/?paymentId=",
// String - Url to which the user will be forwarded when the payment is processed. When a payment is completed, aborted or failed, the postPaymentUrl + the paymentId is pinged. If you add "https://example.com/?paymentId=" as postPaymentUrl and "xzy" is the paymentId you received in the answer, the user will be forwarded to this url: "https://example.com/?paymentId=xzy"

"items" : [
// Array - Products or services that the payment is referring to
{
"id" : "f32d7ce4-15cd-452c-afd3-48c9f73e447f",
// String - Id from your system. Used when refunding items
"desc" : "Dancing shoes",
// String - Description of the item
"count" : 2,
// Optional double - Number of items
"grossAmount" : 1000,
// Double - Price of the item including VAT (tax)
"vatAmount" : 250
// Double - VAT (tax) as part of the the gross amount (original price including VAT)
}
],

"prePayMessage" : "E-store payment: 1 items",
// Optional string - A message describing the payment to be shown in the Swish app
"orderId" : "4578 5837",
// Optional string - A payment reference shown in the Swish app payment history. Used to help your customers identify the payment when speaking to your customer service.

"emailVerificationTo" : "john@snow.com",
// Optional string - Email address to which a verification (receipt) is sent when the transaction is done
"smsVerificationToPayer" : false,
// Optional bool - Send an SMS with the receipt to the user's Swish phone number

"ageLimit" : 18,
// Optional int - Payment cannot be done by someone with an age below the age limit
"hideTest" : false
// Optional bool - Hide the button that auto completes the payment in the test widget (this nevers shows in live mode)
}

CreatePayment endpoint response JSON:
{
"paymentId" : "3b553879-d42c-4aa4-ae8a-2b447984b60a",
// String - The payment id added to the postPaymentUrl and used to get infor about or refund the payment
"paymentUrl" : "https://swish.banksign.com/payment/d56381c4-d569-4420-a5c3-cf8ec21ccc88",
// String - The url to the payment widget where the QR code or autoforward to the Swish app is

"error" : null
// String - If the request fails, an error message appears
}



2) PaymentInfo (POST)


PaymentInfo endpoint JSON:
{
"apiKey": "xxx",
// String - API key given by BankSignering

"paymentId" : "3b553879-d42c-4aa4-ae8a-2b447984b60a"
// Optional string - The payment id from the CreatePayment endpoint
}

PaymentInfo endpoint response JSON:
{
"status" : "PAID",
// String - The status of the payment. The existing statuses are "PAID", "NOT_STARTED", "PENDING" or "FAILURE"

"items" : [
// Array - Products or services in the payment
{
"id" : "f32d7ce4-15cd-452c-afd3-48c9f73e447f",
// String - Id of the item
"desc" : "Dancing shoes",
// String - Description of the item
"count" : 1,
// Double - Number of items
"grossAmount" : 500,
// Double - Price of the item including VAT (tax)
"vatAmount" : 125
// Double - VAT (tax) as part of the the gross amount (original price including VAT)
}
],

"refunds" : [
// Array - If there has been any refunds: a list of the refunds made
{
"refundId" : "e90c5589-f73e-4956-b81e-d11c09e96b4c",
// String - Id of the refund
"refundOrderId" : "9756 4575",
// String - Refund reference shown in the Swish app. Used to help your customers identify the refund when speaking to your customer service.
"refundTime" : "2023-11-14T12:59:32.274Z",
// String - The time the refund was completed
"items" : [
// Array - The refunded items
{
"id" : "f32d7ce4-15cd-452c-afd3-48c9f73e447f",
// String - Id of the refunded item
"desc" : "Dancing shoes",
// String - Description of the refunded item
"count" : 1,
// Double - Number of refunded items
"grossAmount" : 500,
// Double - Value refunded from the gross amount, including VAT (tax)
"vatAmount" : 125
// Double - Refunded VAT (tax)
}
],
}
],

"paymentInfo" : {
"paymentId" : "3b553879-d42c-4aa4-ae8a-2b447984b60a",
// String - The payment id from the CreatePayment endpoint
"orderId" : "4578 5837",
// String - The payment reference you sent in the createPayment endpoint

"paymentNumber" : "46701740605",
// String - The Swish phone number that made the payment
"paymentTime" : "2023-11-14T12:59:32.274Z"
// String - The time the payment was processed

"receiptUrl" : "https://swish.banksignreceipt.com/68f9b12a-a8db-45ba-a651-cc13d99cfde7"
// String - If the payment was done, the repeipt url
},

"failureReason" : "Not enough funds",
// String - If the payment was a "FAILURE", shows the reason from the Swish service.
"failureCode" : "TM01",
// String - Code shown if the payment status was "FAILURE":

RF07:
Transaction declined

BANKIDCL:
Payer cancelled BankId signing

FF10:
Bank system processing error

TM01:
Swish timed out before the payment was started

DS24:
Swish timed out waiting for an answer from the banks after payment was started. Note: If this happens Swish has no knowledge of whether the payment was successful or not. The Merchant should inform its consumer about this and recommend them to check with their bank about the status of this payment.

VR01:
Does not meet age limit. Note: Only M-Commerce case, for E-Commerce case the simulated error will trigger in the ‘Payment request created’ step (first response)

VR02:
SSN does not match enroled customer. Note: Only M-Commerce case, for E-Commerce case the simulated error will trigger in the ‘Payment request created’ step (first response).




"error" : null
// String - If the request fails, an error message appears
}



3) Refund endpoint (POST)


Refund endpoint JSON:
{
"apiKey": "xxx",
// String - API key given by BankSignering
"paymentId" : "c1c53baf-9d97-4678-84e2-311c990fad12",
// String - The paymentId from the response when posting to the CreatePayment endpoint

"items" : [
// Array - Products or services that the refund is referring to
{
"id" : "f32d7ce4-15cd-452c-afd3-48c9f73e447f",
// String - Id from the item in the CreatePayment request
"count" : 1,
// Optional double - Number of items to remove from the payment
"grossAmount" : 500,
// Double - Price to deduct from the item original gross amount (original price including VAT)
"vatAmount" : 125
// Double - VAT (tax) to be removed to original VAT amount (tax)
}
],

"refundOrderId" : "9756 4575",
// Optional string - Refund reference shown in the Swish app. Used to help your customers identify the refund when speaking to your customer service.
"message" : "Partial refund of dancing shoes"
// Optional string - Message describing the refund
}

Refund endpoint response JSON:
{
"refundId" : "3b553879-d42c-4aa4-ae8a-2b447984b60a",
// String - The refund id. Shown in the refunds array if you call the paymentInfo endpoint and refunds are made.
"status" : "REFUNDED",
// String - The status of the refund. The existing statuses are "REFUNDED" or "FAILED"

"refundOrderId" : "9756 4575",
// String - Refund reference shown in the Swish app. Used to help your customers identify the refund when speaking to your customer service.


"error" : null
// String - If the request fails, an error message appears
}



Offertförfrågan

Fyll i dina företagsuppgifter så skickar vi en offert inom 24 h

BankSignering. Intresserad? Kontakta erik.hertsius@banksignering.se eller ring 073 669 55 88

BankSignering. Intresserad? Kontakta erik.hertsius@banksignering.se eller ring 073 669 55 88


Laddar...