{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Generowanie transakcji DirectBilling","description":"Znajdziesz tutaj wszystkie niezbędne informacje dotyczące integracji i obsługi systemu płatności SimPay.pl","siteUrl":"https://docs.simpay.pl","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"generowanie-transakcji-directbilling","__idx":0},"children":["Generowanie transakcji DirectBilling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Aby rozpocząć proces płatności u operatora GSM, musisz wygenerować nową transakcję, odpytując nasze API. W odpowiedzi otrzymasz dedykowany link (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redirectUrl"]},"), na który należy przekierować klienta, aby mógł wpisać swój numer telefonu i potwierdzić obciążenie rachunku."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"endpoint-i-autoryzacja","__idx":1},"children":["Endpoint i autoryzacja"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Endpoint:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /directbilling/{serviceId}/transactions"]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Wersja:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1.0.0"]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Autoryzacja:"]}," Bearer Token (wymaga nagłówka ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization: Bearer TWÓJ_KLUCZ_API"]},")"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parametry-ścieżki-path-parameters","__idx":2},"children":["Parametry ścieżki (Path parameters)"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parametr"},"children":["Parametr"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Typ"},"children":["Typ"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"center","data-label":"Wymagane"},"children":["Wymagane"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Opis"},"children":["Opis"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["serviceId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["TAK"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Identyfikator Twojej usługi DirectBilling (np. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["e14f8074"]},"). Parametr przekazywany bezpośrednio w adresie URL."]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"-unikalna-funkcja-amounttype-zarabiaj-tyle-ile-chcesz","__idx":3},"children":["🌟 Unikalna funkcja: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amountType"]}," (Zarabiaj tyle, ile chcesz!)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Zazwyczaj bramki płatnicze zmuszają Cię do podawania sztywnej kwoty brutto, jaką ma zapłacić klient. W przypadku płatności DirectBilling, gdzie prowizje operatorów potrafią być skomplikowane, wyliczenie odpowiedniej ceny dla klienta bywa kłopotliwe."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Rozwiązaliśmy ten problem, wprowadzając unikalny parametr ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amountType"]}]},"! Pozwala on zdefiniować, ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["czym"]}," w rzeczywistości jest przekazywana przez Ciebie kwota (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amount"]},")."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Dzięki temu możesz wysłać do nas żądanie z komunikatem: ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["\"Chcę zarobić na czysto 10 PLN, wyliczcie za mnie, ile klient musi zapłacić\""]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Dostępne warianty ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amountType"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["gross"]}]}," (domyślne) – kwota, którą podajesz, to finalna kwota brutto, którą zapłaci klient. Twój zysk zostanie wyliczony po odjęciu prowizji."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["net"]}]}," – podajesz kwotę netto."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["required"]}]}," – ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["absolutny hit!"]}," Podajesz kwotę swojej ostatecznej prowizji (ile chcesz zarobić \"na czysto\"). Nasz system sam sprawdzi tabele prowizyjne operatorów i na ich podstawie zażąda od klienta odpowiedniej, wyższej kwoty brutto, aby zagwarantować Ci oczekiwany zysk."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ciało-żądania-request","__idx":4},"children":["Ciało żądania (Request)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Żądanie należy przesłać w formacie JSON (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type: application/json"]},")."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"przykładowy-payload","__idx":5},"children":["Przykładowy Payload"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"amount\": 10.00,\n  \"amountType\": \"required\",\n  \"control\": \"Zamowienie_VIP_123\",\n  \"returns\": {\n    \"complete\": \"https://twojsklep.pl/sukces\",\n    \"failure\": \"https://twojsklep.pl/blad\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"em","attributes":{},"children":["(W powyższym przykładzie sklep informuje SimPay: \"Wygeneruj transakcję, z której chcę otrzymać równe 10.00 PLN do swojego portfela. Sami policzcie brutto\")."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"odpowiedź-sukcesu-http-200-ok","__idx":6},"children":["Odpowiedź sukcesu (HTTP 200 OK)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Gdy żądanie jest poprawne, system utworzy transakcję i zwróci adres przekierowania dla klienta."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": true,\n  \"data\": {\n    \"transactionId\": \"1d87a1b3-18f8-4146-bcb1-c0c9f293b04f\",\n    \"redirectUrl\": \"https://db.simpay.pl/1d87a1b3-18f8-4146-bcb1-c0c9f293b04f\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Wskazówka"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Zapisz wartość ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.transactionId"]}," w swojej bazie danych i powiąż ją z koszykiem klienta. To właśnie po tym ID zidentyfikujesz transakcję, gdy w przyszłości otrzymasz od nas asynchroniczne ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/notifications/directbilling"},"children":["powiadomienie IPN"]}]}," o jej opłaceniu."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"kody-błędów","__idx":7},"children":["Kody błędów"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["W przypadku podania nieprawidłowych danych lub problemów z uwierzytelnieniem, API zwróci jeden z poniższych kodów HTTP wraz z odpowiednim ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]}," w formacie JSON:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["HTTP 401 (Unauthorized)"]}," – brakuje nagłówka z tokenem lub klucz API jest nieprawidłowy (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UNAUTHORIZED"]},")."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["HTTP 403 (Forbidden)"]}," – Twój token nie ma uprawnień do danej akcji lub wykonujesz zapytanie z nieautoryzowanego adresu IP (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["INVALID_ABILITY_PROVIDED"]}," lub ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IP_ADDRESS_NOT_WHITELISTED"]},")."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["HTTP 404 (Not Found)"]}," – nie znaleziono podanej usługi lub błędny adres endpointu (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SERVICE_NOT_FOUND"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ROUTE_NOT_FOUND"]},")."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["HTTP 422 (Unprocessable Entity)"]}," – błąd walidacji przekazanych danych (np. brak wymaganej kwoty). Odpowiedź będzie zawierała obiekt ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errors"]}," ze szczegółami."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Przykład błędu 422:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": false,\n  \"errorCode\": \"VALIDATION_ERROR\",\n  \"errors\": {\n    \"amount\": [\n      \"The amount field is required.\"\n    ]\n  }\n}\n","lang":"json"},"children":[]}]},"headings":[{"value":"Generowanie transakcji DirectBilling","id":"generowanie-transakcji-directbilling","depth":1},{"value":"Endpoint i autoryzacja","id":"endpoint-i-autoryzacja","depth":2},{"value":"Parametry ścieżki (Path parameters)","id":"parametry-ścieżki-path-parameters","depth":3},{"value":"🌟 Unikalna funkcja: amountType (Zarabiaj tyle, ile chcesz!)","id":"-unikalna-funkcja-amounttype-zarabiaj-tyle-ile-chcesz","depth":2},{"value":"Ciało żądania (Request)","id":"ciało-żądania-request","depth":2},{"value":"Przykładowy Payload","id":"przykładowy-payload","depth":3},{"value":"Odpowiedź sukcesu (HTTP 200 OK)","id":"odpowiedź-sukcesu-http-200-ok","depth":2},{"value":"Kody błędów","id":"kody-błędów","depth":2}],"frontmatter":{"seo":{"title":"Generowanie transakcji DirectBilling"}},"lastModified":"2026-05-12T14:19:02.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/directbilling/transaction","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}