> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mangopay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Klarna PayIn

<Note>
  **Note – Timeout after 3 hours**

  The Klarna payment session lasts 3 hours, at which point the pay-in fails automatically (result code [101109](/errors/codes/101109)) if no action has been taken by the user.
</Note>

<Note>
  **Note – Minimum amount in Production**

  In Production, the minimum accepted `DebitedFunds` amount for Klarna is `1` (regardless of currency).
</Note>

### Body parameters

<ParamField body="Tag" type="string">
  Max. length: 255 characters

  Custom data that you can add to this object.\
  For transactions (pay-in, transfer, payout), you can use this parameter to identify corresponding information regarding the user, transaction, or payment methods on your platform.
</ParamField>

<ParamField body="AuthorId" type="string" required>
  The unique identifier of the user at the source of the transaction.
</ParamField>

<ParamField body="DebitedFunds" type="object" required>
  Information about the debited funds. The amount must be equal to the total of all `UnitAmount` and `TaxAmount` of all `LineItems`.

  <Expandable title="properties">
    <ParamField body="Currency" type="string" required>
      **Allowed values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

      The currency of the funds.
    </ParamField>

    <ParamField body="Amount" type="integer" required>
      An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="Fees" type="object" required>
  Information about the fees.

  <Expandable title="properties">
    <ParamField body="Currency" type="string" required>
      **Allowed values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

      The currency of the fees.
    </ParamField>

    <ParamField body="Amount" type="integer" required>
      An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="CreditedWalletId" type="string" required>
  The unique identifier of the credited wallet.
</ParamField>

<ParamField body="ReturnURL" type="string" required>
  Max. length: 255 characters

  The URL to which the user is returned after the payment, whether the transaction is successful or not.
</ParamField>

<ParamField body="StatementDescriptor" type="string">
  Max. length: 10 characters; only alphanumeric and spaces

  Custom description to appear on the user’s bank statement along with the platform name. Different banks may show more or less information. See the <a href="/bank-statements">Customizing bank statement references</a> article for details.
</ParamField>

<ParamField body="Billing" type="object" required>
  Information about the end user billing address.

  <Expandable title="properties">
    <ParamField body="FirstName" type="string">
      The first name of the user.
    </ParamField>

    <ParamField body="LastName" type="string">
      Max. length: 100 characters

      The last name of the user.
    </ParamField>

    <ParamField body="Address" type="object">
      Information about the billing address.

      <Expandable title="properties">
        <ParamField body="AddressLine1" type="string" required>
          Max. length: 255 characters

          The first line of the address.
        </ParamField>

        <ParamField body="AddressLine2" type="string">
          Max. length: 255 characters

          The second line of the address.
        </ParamField>

        <ParamField body="City" type="string">
          Max. length: 255 characters

          The city of the address.
        </ParamField>

        <ParamField body="Region" type="string">
          Max. length: 255 characters

          Required if `Country` is US, CA, or MX.

          The region of the address.
        </ParamField>

        <ParamField body="PostalCode" type="string" required>
          Max. length: 255 characters

          The postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
        </ParamField>

        <ParamField body="Country" type="string">
          The country of the address, which (if sent) must be the same as the `Country` parameter.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="Shipping" type="object">
  Information about the end user’s shipping address.\
  The shipping address `AddressLine1` must be formatted:

  * FR, UK, US: \[Number]\[StreetName], for example: 33 Cavendish Square
  * Rest of EU: \[StreetName]\[Number], for example: De Ruijterkade 7\
    Caution: Failure to follow this formatting may result in an error.\
    If no shipping address is sent, Klarna considers it to be the same as the billing address.

  <Expandable title="properties">
    <ParamField body="FirstName" type="string">
      The first name of the user.
    </ParamField>

    <ParamField body="LastName" type="string">
      Max. length: 100 characters

      The last name of the user.
    </ParamField>

    <ParamField body="Address" type="object" required>
      Information about the shipping address.

      <Expandable title="properties">
        <ParamField body="AddressLine1" type="string" required>
          Max. length: 255 characters

          The first line of the address.
        </ParamField>

        <ParamField body="AddressLine2" type="string">
          Max. length: 255 characters

          The second line of the address.
        </ParamField>

        <ParamField body="City" type="string" required>
          Max. length: 255 characters

          The city of the address.
        </ParamField>

        <ParamField body="Region" type="string">
          Max. length: 255 characters

          Required if `Country` is US, CA, or MX.

          The region of the address.
        </ParamField>

        <ParamField body="PostalCode" type="string" required>
          Max. length: 255 characters

          The postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
        </ParamField>

        <ParamField body="Country" type="string" required>
          Format: Two-letter country code ([ISO 3166-1 alpha-2 format](/api-reference/overview/data-formats))

          The country of the address.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="LineItems" type="array (object)" required>
  Information about the items purchased in the transaction. The pay-in `DebitedFunds.Amount` must equal all `LineItems` objects' ((`UnitAmount` + `TaxAmount`) - `Discount`).

  <Expandable title="properties">
    <ParamField body="Name" type="string" required>
      The name of the item.
    </ParamField>

    <ParamField body="Quantity" type="integer" required>
      The quantity of the item.
    </ParamField>

    <ParamField body="UnitAmount" type="integer" required>
      The cost of the item, excluding tax.
    </ParamField>

    <ParamField body="TaxAmount" type="integer">
      The tax amount applied to the item.
    </ParamField>

    <ParamField body="Sku" type="string">
      The unique identifier of the line item.
    </ParamField>

    <ParamField body="Category" type="string">
      Possible values: `DIGITAL_GOODS`, `PHYSICAL_GOODS`, `DISCOUNT`, `SHIPPING_FEE`, `SALES_TAX`, `GIFT_CARD`, `STORE_CREDIT`, `SURCHARGE`

      The category of the item, allowing line items of different types to be distinguished (for example, buyer protection as `DIGITAL_GOODS`).
    </ParamField>

    <ParamField body="Discount" type="integer">
      The discount applied to the item.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="Country" type="string" required>
  Format: Two-letter country code ([ISO 3166-1 alpha-2 format](/api-reference/overview/data-formats))

  The country of residence of the user.
</ParamField>

<ParamField body="Culture" type="string">
  Format: Two-letter language code ([ISO 639-1 alpha-2](/api-reference/overview/data-formats))

  The language in which the Klarna payment page is to be displayed.

  The `Culture` must match the `Country` to show the checkout page in the desired language. If not, or if `Culture` is not sent, EN is the language by default.
</ParamField>

<ParamField body="Email" type="string" required>
  Format: A valid email address

  The user’s email address.
</ParamField>

<ParamField body="Phone" type="string">
  Format: International E.164 standard (preceded by plus sign and country code)

  The user's mobile phone number. If the phone matches the user’s Klarna account, their checkout experience involves one less step.
</ParamField>

<ParamField body="AdditionalData" type="string">
  Format: Serialized JSON object

  The extra merchant data required by Klarna for the transaction, as described in the <a href="https://mangopay.com/docs/concepts/payments/payment-methods/klarna" target="_blank">Klarna</a> guide.
</ParamField>

<ParamField body="Reference" type="string" required>
  The platform’s order reference for the transaction.
</ParamField>

<ParamField body="ProfilingAttemptReference" type="string">
  The unique reference generated for the profiling session, used by the <a href="/guides/fraud-prevention">fraud prevention</a> solution to produce recommendations for the transaction using the profiling data.

  **Note:** Parameter not returned by the API. Profiling feature available on request – contact Mangopay <a href="https://hub.mangopay.com/" target="_blank">via the Dashboard</a> for more information.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200 - Response parameters">
    <ResponseField name="Id" type="string">
      Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details)

      The unique identifier of the object.
    </ResponseField>

    <ResponseField name="Tag" type="string">
      Max. length: 255 characters

      Custom data that you can add to this object.\
      For transactions (pay-in, transfer, payout), you can use this parameter to identify corresponding information regarding the user, transaction, or payment methods on your platform.
    </ResponseField>

    <ResponseField name="CreationDate" type="Unix timestamp">
      The date and time at which the object was created.
    </ResponseField>

    <ResponseField name="AuthorId" type="string">
      The unique identifier of the user at the source of the transaction.
    </ResponseField>

    <ResponseField name="DebitedFunds" type="object">
      Information about the debited funds. The amount must be equal to the total of all `UnitAmount` and `TaxAmount` of all `LineItems`.

      <Expandable title="properties">
        <ResponseField name="Currency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the funds.
        </ResponseField>

        <ResponseField name="Amount" type="integer">
          An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`).
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="CreditedFunds" type="object">
      Information about the credited funds (`CreditedFunds` = `DebitedFunds` - `Fees`).

      <Expandable title="properties">
        <ResponseField name="Currency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the funds.
        </ResponseField>

        <ResponseField name="Amount" type="integer">
          An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`).
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Fees" type="object">
      Information about the fees.

      <Expandable title="properties">
        <ResponseField name="Currency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the fees.
        </ResponseField>

        <ResponseField name="Amount" type="integer">
          An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`).
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Status" type="string">
      **Returned values:** `CREATED`, `SUCCEEDED`, `FAILED`

      The status of the transaction.
    </ResponseField>

    <ResponseField name="ResultCode" type="string">
      The code indicating the result of the operation. This information is mostly used to <a href="/errors/codes">handle errors</a> or for filtering purposes.
    </ResponseField>

    <ResponseField name="ResultMessage" type="string">
      The explanation of the result code.
    </ResponseField>

    <ResponseField name="ExecutionDate" type="Unix timestamp">
      The date and time at which the status changed to `SUCCEEDED`, indicating that the transaction occurred. The statuses `CREATED` and `FAILED` return an `ExecutionDate` of `null`.
    </ResponseField>

    <ResponseField name="Type" type="string">
      **Returned values:** `PAYIN`, `TRANSFER`, `CONVERSION`, `PAYOUT`

      The type of the transaction.
    </ResponseField>

    <ResponseField name="Nature" type="string">
      **Returned values:** `REGULAR`, `REPUDIATION`, `REFUND`, `SETTLEMENT`

      The nature of the transaction, providing more information about the context in which the transaction occurred:

      * `REGULAR` – Relative to most of the transactions (pay-ins, payouts, and transfers) in a usual workflow.
      * `REPUDIATION` – Automatic withdrawal of funds from the platform’s repudiation wallet as part of the dispute process (when the user has requested a chargeback).
      * `REFUND` – Reimbursement of a transaction to the user (pay-in refund), to a wallet (transfer refund), or of a payout (payout refund, only initiated by Mangopay).
      * `SETTLEMENT` – Transfer made to the repudiation wallet by the platform to settle a lost dispute.
    </ResponseField>

    <ResponseField name="CreditedWalletId" type="string">
      The unique identifier of the credited wallet.
    </ResponseField>

    <ResponseField name="CreditedUserId" type="string">
      **Default value:** The unique identifier of the owner of the credited wallet.

      The unique identifier of the user whose wallet is credited.
    </ResponseField>

    <ResponseField name="PaymentType" type="string">
      **Returned values:** `KLARNA`

      The type of pay-in.
    </ResponseField>

    <ResponseField name="ExecutionType" type="string">
      **Returned values:** `WEB`, `DIRECT`, `EXTERNAL_INSTRUCTION`

      The type of execution for the pay-in.
    </ResponseField>

    <ResponseField name="ReturnURL" type="string">
      Max. length: 255 characters

      The URL to which the user is returned after the payment, whether the transaction is successful or not.
    </ResponseField>

    <ResponseField name="RedirectURL" type="string">
      The URL to which to redirect the user to complete the payment.

      **Caution:** This variable URL is specific to each payment. You must rely on the returned URL in full (host, path, and queries) and not hardcode any part of it.
    </ResponseField>

    <ResponseField name="StatementDescriptor" type="string">
      Max. length: 10 characters; only alphanumeric and spaces

      Custom description to appear on the user’s bank statement along with the platform name. Different banks may show more or less information. See the <a href="/bank-statements">Customizing bank statement references</a> article for details.
    </ResponseField>

    <ResponseField name="Billing" type="object">
      Information about the end user billing address.

      <Expandable title="properties">
        <ResponseField name="FirstName" type="string">
          The first name of the user.
        </ResponseField>

        <ResponseField name="LastName" type="string">
          Max. length: 100 characters

          The last name of the user.
        </ResponseField>

        <ResponseField name="Address" type="object">
          Information about the billing address.

          <Expandable title="properties">
            <ResponseField name="AddressLine1" type="string">
              Max. length: 255 characters

              The first line of the address.
            </ResponseField>

            <ResponseField name="AddressLine2" type="string">
              Max. length: 255 characters

              The second line of the address.
            </ResponseField>

            <ResponseField name="City" type="string">
              Max. length: 255 characters

              The city of the address.
            </ResponseField>

            <ResponseField name="Region" type="string">
              Max. length: 255 characters

              The region of the address. This field is optional except if the `Country` is US, CA, or MX.
            </ResponseField>

            <ResponseField name="PostalCode" type="string">
              Max. length: 255 characters

              The postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
            </ResponseField>

            <ResponseField name="Country" type="string">
              Format: Two-letter country code ([ISO 3166-1 alpha-2 format](/api-reference/overview/data-formats))

              The country of the address.
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Shipping" type="object">
      Information about the end user’s shipping address.

      The shipping address `AddressLine1` must be formatted:

      * FR, UK, US: \[Number]\[StreetName], for example: 33 Cavendish Square
      * Rest of EU: \[StreetName]\[Number], for example: De Ruijterkade 7

      **Caution:** Failure to follow this formatting may result in an error.

      If no shipping address is sent, Klarna considers it to be the same as the billing address.

      <Expandable title="properties">
        <ResponseField name="FirstName" type="string">
          The first name of the user.
        </ResponseField>

        <ResponseField name="LastName" type="string">
          Max. length: 100 characters

          The last name of the user.
        </ResponseField>

        <ResponseField name="Address" type="object">
          Information about the shipping address.

          <Expandable title="properties">
            <ResponseField name="AddressLine1" type="string">
              Max. length: 255 characters

              The first line of the address.
            </ResponseField>

            <ResponseField name="AddressLine2" type="string">
              Max. length: 255 characters

              The second line of the address.
            </ResponseField>

            <ResponseField name="City" type="string">
              Max. length: 255 characters

              The city of the address.
            </ResponseField>

            <ResponseField name="Region" type="string">
              Max. length: 255 characters

              The region of the address. This field is optional except if the `Country` is US, CA, or MX.
            </ResponseField>

            <ResponseField name="PostalCode" type="string">
              Max. length: 255 characters

              The postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
            </ResponseField>

            <ResponseField name="Country" type="string">
              Format: Two-letter country code ([ISO 3166-1 alpha-2 format](/api-reference/overview/data-formats))

              The country of the address.
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="LineItems" type="array (object)">
      Information about the items purchased in the transaction. The pay-in `DebitedFunds.Amount` must equal all `LineItems` objects' ((`UnitAmount` + `TaxAmount`) - `Discount`).

      <Expandable title="properties">
        <ResponseField name="Name" type="string">
          The name of the item.
        </ResponseField>

        <ResponseField name="Quantity" type="integer">
          The quantity of the item.
        </ResponseField>

        <ResponseField name="UnitAmount" type="integer">
          The cost of the item, excluding tax.
        </ResponseField>

        <ResponseField name="TaxAmount" type="integer">
          The tax amount applied to the item.
        </ResponseField>

        <ResponseField name="Sku" type="string">
          The unique identifier of the line item.
        </ResponseField>

        <ResponseField name="Category" type="string">
          Possible values: `DIGITAL_GOODS`, `PHYSICAL_GOODS`, `DISCOUNT`, `SHIPPING_FEE`, `SALES_TAX`, `GIFT_CARD`, `STORE_CREDIT`, `SURCHARGE`

          The category of the item, allowing line items of different types to be distinguished (for example, buyer protection as `DIGITAL_GOODS`).
        </ResponseField>

        <ResponseField name="Discount" type="integer">
          The discount applied to the item.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Country" type="string">
      Format: Two-letter country code ([ISO 3166-1 alpha-2 format](/api-reference/overview/data-formats))

      The country of residence of the user.
    </ResponseField>

    <ResponseField name="Culture" type="string">
      Format: Two-letter language code ([ISO 639-1 alpha-2](/api-reference/overview/data-formats))

      The language in which the Klarna payment page is to be displayed.\
      The `Culture` must match the `Country` to show the checkout page in the desired language. If not, or if `Culture` is not sent, EN is the language by default.
    </ResponseField>

    <ResponseField name="Email" type="string">
      Format: A valid email address

      The user’s email address.
    </ResponseField>

    <ResponseField name="Phone" type="string">
      Format: International E.164 standard (preceded by plus sign and country code)

      The user's mobile phone number. If the phone matches the user’s Klarna account, their checkout experience involves one less step.
    </ResponseField>

    <ResponseField name="AdditionalData" type="string">
      Format: Serialized JSON object

      The extra merchant data required by Klarna for the transaction, as described in the <a href="https://mangopay.com/docs/concepts/payments/payment-methods/klarna" target="_blank">Klarna</a> guide.
    </ResponseField>

    <ResponseField name="Reference" type="string">
      The platform’s order reference for the transaction.
    </ResponseField>
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="400 - Billing address country doesn't match Country">
    ```json theme={null}
    {
        "message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
        "id": "5c1bd99e-3af9-4ac2-997a-daec27b8a255",
        "date": 1710162995,
        "type": "param_error",
        "errors": {
            "billing.Country": "The field should equal Country"
        }
    }  
    ```
  </Accordion>

  <Accordion title="400 - AdditionalData JSON format error">
    ```json theme={null}
    {
        "message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
        "id": "34554ec3-e46e-49f2-b29c-12db3e7e1c90",
        "date": 1706798154,
        "type": "param_error",
        "errors": {
            "additionalData": "The value is not a valid JSON format"
        }
    }  
    ```
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200 theme={null}
  {
      "Id": "wt_5a175522-04c3-4115-88ef-3b1b3446c4c6",
      "Tag": "Created using the Mangopay API Postman collection",
      "CreationDate": 1706797249,
      "AuthorId": "213407540",
      "DebitedFunds": {
          "Currency": "EUR",
          "Amount": 1300
      },
      "CreditedFunds": {
          "Currency": "EUR",
          "Amount": 1000
      },
      "Fees": {
          "Currency": "EUR",
          "Amount": 300
      },
      "Status": "CREATED",
      "ResultCode": null,
      "ResultMessage": null,
      "ExecutionDate": null,
      "Type": "PAYIN",
      "Nature": "REGULAR",
      "CreditedWalletId": "213407543",
      "CreditedUserId": "213407540",
      "PaymentType": "KLARNA",
      "ExecutionType": "WEB",
      "ReturnURL": "http://www.mangopay.com/docs/please-ignore?transactionId=wt_5a175522-04c3-4115-88ef-3b1b3446c4c6",
      "RedirectURL": "https://pay.playground.klarna.com/eu/hpp/payments/2fuacUE",
      "StatementDescriptor": "Mangopay",
      "Billing": {
          "FirstName": "Alex",
          "LastName": "Smith",
          "Address": {
              "AddressLine1": "6 rue de la Cité",
              "AddressLine2": "Appartement 3",
              "City": "Paris",
              "Region": "île-de-france",
              "PostalCode": "75003",
              "Country": "FR"
          }
      },
      "Shipping": {
          "FirstName": "Alex",
          "LastName": "Smith",
          "Address": {
              "AddressLine1": "Rue de la Fourche 26",
              "AddressLine2": "Appartement 3",
              "City": "Bruxelles",
              "Region": "Bruxelles-Capitale",
              "PostalCode": "75003",
              "Country": "BE"
          }
      },
      "LineItems": [
          {
              "Name": "Running shoes",
              "Quantity": 2,
              "UnitAmount": 400,
              "TaxAmount": 100,
              "Description": "ID of Seller 1",
              "Category": "PHYSICAL_GOODS",
              "Sku": "example-item-123",
              "Discount": 100
          },
          {
              "Name": "Walking shoes",
              "Quantity": 1,
              "UnitAmount": 400,
              "TaxAmount": 100,
              "Description": "ID of Seller 2",
              "Category": "PHYSICAL_GOODS",
              "Sku": "example-item-456",
              "Discount": 100
          }
      ],
      "Country": "FR",
      "Culture": "FR",
      "Email": "alex.smith@example.com",
      "Phone": "[+33][689854321]",
      "AdditionalData": "{\"customer_account_info\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"app_id\": \"81363501-3540-494a-8627-33bc6112035d\",\"loyalty_level\": \"high\",\"customer_email\": \"customer@email.com\",\"customer_phone\": \"0611223344\",\"customer_ranking\": 2,\"customer_reviews\": 5,\"last_login_time\": \"2023-10-21T19:11:34Z\",\"account_security\": {\"last_verification_method\": \"2FA TOTP\",\"last_verification_time\": \"2023-10-21T19:11:34Z\",\"device_id\": \"772af5a5-2d55-4a5e-bb79-85969f683810\",\"fraud_behavior\": false,\"devices_linked\": 2,\"phone_verified\": true,\"email_verified\": true,\"failed_transactions_attempts\": 0},\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": \"2022-12-22T18:45:44Z\"}],\"marketplace_seller_info\": [{\"sub_merchant_id\": \"615a0e87-4941-45dc-978d-e6efcbd90ba0\",\"sub_merchant_name\": \"Marketbrick Ltd.\",\"sub_merchant_postal_code\": \"75010\",\"product_category\": \"Computers\",\"product_name\": \"Asus Zenbook 14\",\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2020-06-10T12:02:21Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2020-06-10T12:02:21Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"digital_download\": false,\"seller_rating\": 4.5,\"number_of_trades\": 34,\"volume_of_trades\": 4500}],\"payment_history_full\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 10,\"payment_option\": \"card\",\"total_amount_paid_purchases\": 1000.10,\"date_of_first_paid_purchase\": \"2020-06-10T12:12:34Z\",\"date_of_last_paid_purchase\": \"2023-10-26T18:52:38Z\"},{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 14,\"payment_option\": \"non klarna credit\",\"total_amount_paid_purchases\": 2322.10,\"date_of_first_paid_purchase\": \"2021-10-11T20:31:15Z\",\"date_of_last_paid_purchase\": \"2023-09-22T14:59:22Z\"}],\"marketplace_winner_info\": [{\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2022-12-22T18:45:44Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2023-08-14T08:23:34Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"number_of_trades\": 24,\"volume_of_trades\": 3322}],\"other_delivery_address\": [{\"shipping_method\": \"pick-up point\",\"shipping_type\": \"express\",\"first_name\": \"Test\",\"last_name\": \"Person\",\"street_address\": \"Rue La Fayette\",\"street_number\": \"33\",\"postal_code\": \"75009\",\"city\": \"Paris\",\"country\": \"FR\"}]}",
      "Reference": "1234"
  }  
  ```
</ResponseExample>

<RequestExample>
  ```json REST   theme={null}
  {
      "Tag": "Created using the Mangopay API Postman collection",
      "AuthorId": "213407540",
      "DebitedFunds": {
          "Currency": "EUR",
          "Amount": 1300
      },
      "Fees": {
          "Currency": "EUR",
          "Amount": 300
      },
      "CreditedWalletId": "213407543",
      "ReturnURL": "http://www.mangopay.com/docs/please-ignore",
      "StatementDescriptor": "Mangopay",
      "Billing": {
          "FirstName": "Alex",
          "LastName": "Smith",
          "Address": {
              "AddressLine1": "6 rue de la Cité",
              "AddressLine2": "Appartement 3",
              "City": "Paris",
              "Region": "île-de-france",
              "PostalCode": "75003",
              "Country": "FR"
          }
      },
      "Shipping": {
          "FirstName": "Alex",
          "LastName": "Smith",
          "Address": {
              "AddressLine1": "Rue de la Fourche 26",
              "AddressLine2": "Appartement 3",
              "City": "Bruxelles",
              "Region": "Bruxelles-Capitale",
              "PostalCode": "75003",
              "Country": "BE"
          }
      },
      "LineItems": [
          {
              "Name": "Running shoes",
              "Quantity": 2,
              "UnitAmount": 400,
              "TaxAmount": 100,
              "Description": "ID of Seller 1",
              "Category": "PHYSICAL_GOODS",
              "Sku": "example-item-123",
              "Discount": 100,
          },
          {
              "Name": "Walking shoes",
              "Quantity": 1,
              "UnitAmount": 400,
              "TaxAmount": 100,
              "Description": "ID of Seller 2",
              "Category": "PHYSICAL_GOODS",
              "Sku": "example-item-456",
              "Discount": 100,
          }
      ],
      "Country": "FR",
      "Culture": "FR",
      "Email": "alex.smith@example.com",
      "Phone": "[+33][689854321]",
      "AdditionalData": "{\"customer_account_info\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"app_id\": \"81363501-3540-494a-8627-33bc6112035d\",\"loyalty_level\": \"high\",\"customer_email\": \"customer@email.com\",\"customer_phone\": \"0611223344\",\"customer_ranking\": 2,\"customer_reviews\": 5,\"last_login_time\": \"2023-10-21T19:11:34Z\",\"account_security\": {\"last_verification_method\": \"2FA TOTP\",\"last_verification_time\": \"2023-10-21T19:11:34Z\",\"device_id\": \"772af5a5-2d55-4a5e-bb79-85969f683810\",\"fraud_behavior\": false,\"devices_linked\": 2,\"phone_verified\": true,\"email_verified\": true,\"failed_transactions_attempts\": 0},\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": \"2022-12-22T18:45:44Z\"}],\"marketplace_seller_info\": [{\"sub_merchant_id\": \"615a0e87-4941-45dc-978d-e6efcbd90ba0\",\"sub_merchant_name\": \"Marketbrick Ltd.\",\"sub_merchant_postal_code\": \"75010\",\"product_category\": \"Computers\",\"product_name\": \"Asus Zenbook 14\",\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2020-06-10T12:02:21Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2020-06-10T12:02:21Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"digital_download\": false,\"seller_rating\": 4.5,\"number_of_trades\": 34,\"volume_of_trades\": 4500}],\"payment_history_full\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 10,\"payment_option\": \"card\",\"total_amount_paid_purchases\": 1000.10,\"date_of_first_paid_purchase\": \"2020-06-10T12:12:34Z\",\"date_of_last_paid_purchase\": \"2023-10-26T18:52:38Z\"},{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 14,\"payment_option\": \"non klarna credit\",\"total_amount_paid_purchases\": 2322.10,\"date_of_first_paid_purchase\": \"2021-10-11T20:31:15Z\",\"date_of_last_paid_purchase\": \"2023-09-22T14:59:22Z\"}],\"marketplace_winner_info\": [{\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2022-12-22T18:45:44Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2023-08-14T08:23:34Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"number_of_trades\": 24,\"volume_of_trades\": 3322}],\"other_delivery_address\": [{\"shipping_method\": \"pick-up point\",\"shipping_type\": \"express\",\"first_name\": \"Test\",\"last_name\": \"Person\",\"street_address\": \"Rue La Fayette\",\"street_number\": \"33\",\"postal_code\": \"75009\",\"city\": \"Paris\",\"country\": \"FR\"}]}",
      "Reference": "1234"
  }  
  ```

  ```php PHP theme={null}
  <?php
      require_once 'vendor/autoload.php';

      use MangoPay\MangoPayApi;
      use MangoPay\Libraries\ResponseException as MGPResponseException;
      use MangoPay\Libraries\Exception as MGPException;
      
      $api = new MangoPayApi();
      
      $api->Config->ClientId = 'your-client-id';
      $api->Config->ClientPassword = 'your-api-key';
      $api->Config->TemporaryFolder = 'tmp/';

      
      try {


          $user = $api->Users->Get('210513027');

          $payIn = new \MangoPay\PayIn();
          $payIn->Tag = "Created using Mangopay PHP SDK";
          $payIn->CreditedWalletId = "210514820";
          $payIn->PaymentType = "KLARNA";
          $payIn->AuthorId = $user->Id;

          $payIn->DebitedFunds = new \MangoPay\Money();
          $payIn->DebitedFunds->Currency = 'EUR';
          $payIn->DebitedFunds->Amount = 1500;

          $payIn->Fees = new \MangoPay\Money();
          $payIn->Fees->Currency = 'EUR';
          $payIn->Fees->Amount = 300;
          
          $payIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsWeb();
          $payIn->ExecutionDetails->ReturnURL = "http://example.com"; 
          $payIn->ExecutionDetails->Culture = 'FR';
      
          $payIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsKlarna();
          $payIn->PaymentDetails->Email = $user->Email;
          $payIn->PaymentDetails->Phone = '[+33][689854321]';
          $payIn->PaymentDetails->Country = $user->Address->Country;
          $payIn->PaymentDetails->AdditionalData = "your-additional-data"
          $payIn->PaymentDetails->Reference = '8569';

          $payIn->ExecutionDetails->Billing = new \MangoPay\Billing();
          $payIn->ExecutionDetails->Billing->FirstName = $user->FirstName;
          $payIn->ExecutionDetails->Billing->LastName = $user->LastName;
          $payIn->ExecutionDetails->Billing->Address = new \MangoPay\Address();
          $payIn->ExecutionDetails->Billing->Address->AddressLine1 =$user->Address->AddressLine1;
          $payIn->ExecutionDetails->Billing->Address->AddressLine2 =$user->Address->AddressLine2;
          $payIn->ExecutionDetails->Billing->Address->Region = $user->Address->Region;
          $payIn->ExecutionDetails->Billing->Address->City = $user->Address->City;
          $payIn->ExecutionDetails->Billing->Address->PostalCode = $user->Address->PostalCode;
          $payIn->ExecutionDetails->Billing->Address->Country = $user->Address->Country;

          $payIn->PaymentDetails->Shipping = new \MangoPay\Shipping();
          $payIn->PaymentDetails->Shipping->FirstName = $user->FirstName;
          $payIn->PaymentDetails->Shipping->LastName = $user->LastName;
          $payIn->PaymentDetails->Shipping->Address = new \MangoPay\Address();
          $payIn->PaymentDetails->Shipping->Address->AddressLine1 =$user->Address->AddressLine1;
          $payIn->PaymentDetails->Shipping->Address->AddressLine2 =$user->Address->AddressLine2;
          $payIn->PaymentDetails->Shipping->Address->Region = $user->Address->Region;
          $payIn->PaymentDetails->Shipping->Address->City = $user->Address->City;
          $payIn->PaymentDetails->Shipping->Address->PostalCode = $user->Address->PostalCode;
          $payIn->PaymentDetails->Shipping->Address->Country = $user->Address->Country;
          
          $lineItem1 = new \MangoPay\LineItem();
          $lineItem1->Name = 'Running shoes';
          $lineItem1->Quantity = 1;
          $lineItem1->UnitAmount = 400;
          $lineItem1->TaxAmount = 100;
          $lineItem1->Description = 'ID of Seller 1';

          $lineItem2 = new \MangoPay\LineItem();
          $lineItem2->Name = 'Walking shoes';
          $lineItem2->Quantity = 2;
          $lineItem2->UnitAmount = 400;
          $lineItem2->TaxAmount = 100;
          $lineItem2->Description = 'ID of Seller 2';

          $payIn->PaymentDetails->LineItems = array($lineItem1, $lineItem2);
          
          $response = $api->PayIns->Create($payIn);
      
          print_r($response);
      } catch(MGPResponseException $e) {
          print_r($e);
      } catch(MGPException $e) {
          print_r($e);
      }  
  ```

  ```javascript NodeJS   theme={null}
  const mangopayInstance = require('mangopay4-nodejs-sdk');
  const mangopay = new mangopayInstance({
      clientId: "your-client-id",
      clientApiKey: "your-api-key",
  })

  let myPayIn = {
      PaymentType: 'KLARNA',
      ExecutionType: 'WEB',
      AuthorId: '210513027',
      Tag: 'Created with Mangopay Node.js SDK',
      CreditedUserId: '210513027',
      DebitedFunds: { 
          Currency: 'EUR', 
          Amount: 400 
      },
      Fees: { 
          Currency: 'EUR', 
          Amount: 10 
      },
      LineItems: [
          {
              Name: "Running shoes",
              Quantity: 1,
              UnitAmount: 200,
              TaxAmount: 0,
              Description: "seller1 ID"
          },
          {
              Name: "Running shoes",
              Quantity: 1,
              UnitAmount: 200,
              TaxAmount: 0,
              Description: "seller2 ID"
          }
      ],
      Country: 'FR',
      Phone: '33#607080900',
      Email: 'mango@mangopay.com',
      CreditedWalletId: '210514820',
      ReturnURL: 'http://example.com',
      Culture: 'FR',
      Billing: {
          FirstName: 'Alex',
          LastName: 'Smith',
          Address: {
            AddressLine1: 'Rue des plantes',
            AddressLine2: 'The Oasis',
            City: 'Paris',
            Region: 'IDF',
            PostalCode: '75000',
            Country: 'FR',
          },
      },
      Shipping: {
          FirstName: 'Alex',
          LastName: 'Smith',
          Address: {
              AddressLine1: 'Rue des plantes',
              AddressLine2: 'The Oasis',
              City: 'Paris',
              Region: 'IDF',
              PostalCode: '75000',
              Country: 'FR',
          },
      },
      AdditionalData: 'your-additional-data',
      StatementDescriptor: 'Feb2024',
      Reference: 'afd48-879d-48fg'
  }

  const createKlarnaPayIn = async (payin) => {
      return await mangopay.PayIns.create(payin)
        .then((response) => {
          console.info(response)
          return response
        })
        .catch((err) => {
          console.log(err)
          return false
        })
    }
    
  createKlarnaPayIn(myPayIn)  
  ```

  ```ruby Ruby   theme={null}
  require 'mangopay'

  require 'PP'

  MangoPay.configure do |client|
      client.preproduction = true
      client.client_id = 'your-client-id'
      client.client_apiKey = 'your-api-key'
      client.log_file = File.join(Dir.pwd, 'mangopay.log')
  end

  let myPayIn = {
      PaymentType: 'KLARNA',
      ExecutionType: 'WEB',
      AuthorId: '210513027',
      Tag: 'Created with Mangopay Node.js SDK',
      CreditedUserId: '210513027',
      DebitedFunds: { 
          Currency: 'EUR', 
          Amount: 400 
      },
      Fees: { 
          Currency: 'EUR', 
          Amount: 10 
      },
      LineItems: [
          {
              Name: "running shoes",
              Quantity: 1,
              UnitAmount: 200,
              TaxAmount: 0,
              Description: "seller1 ID"
          },
          {
              Name: "running shoes",
              Quantity: 1,
              UnitAmount: 200,
              TaxAmount: 0,
              Description: "seller2 ID"
          }
      ],
      Country: 'FR',
      Phone: '33#607080900',
      Email: 'mango@mangopay.com',
      CreditedWalletId: '210514820',
      ReturnURL: 'http://example.com',
      Culture: 'FR',
      Billing: {
          FirstName: 'Alex',
          LastName: 'Smith',
          Address: {
            AddressLine1: 'Rue des plantes',
            AddressLine2: 'The Oasis',
            City: 'Paris',
            Region: 'IDF',
            PostalCode: '75000',
            Country: 'FR',
          },
      },
      Shipping: {
          FirstName: 'Alex',
          LastName: 'Smith',
          Address: {
              AddressLine1: 'Rue des plantes',
              AddressLine2: 'The Oasis',
              City: 'Paris',
              Region: 'IDF',
              PostalCode: '75000',
              Country: 'FR',
          },
      },
      StatementDescriptor: 'Feb2024',
      Reference: 'afd48-879d-48fg',
      AdditionalData: "your-additional-data"
  }

  const createKlarnaPayIn = async (payin) => {
      return await mangopay.PayIns.create(payin)
        .then((response) => {
          console.info(response)
          return response
        })
        .catch((err) => {
          console.log(err)
          return false
        })
    }
    
  pp(createKlarnaPayIn(myPayIn))  
  ```

  ```java Java   theme={null}
  import com.google.gson.Gson;
  import com.google.gson.GsonBuilder;
  import com.mangopay.MangoPayApi;
  import com.mangopay.core.Address;
  import com.mangopay.core.Billing;
  import com.mangopay.core.LineItem;
  import com.mangopay.core.Money;
  import com.mangopay.entities.PayIn;
  import com.mangopay.entities.User;
  import com.mangopay.entities.subentities.PayInExecutionDetailsWeb;
  import com.mangopay.entities.subentities.PayInPaymentDetailsKlarna;
  import com.mangopay.core.enumerations.PayInExecutionType;
  import com.mangopay.core.enumerations.PayInPaymentType;
  import com.mangopay.core.enumerations.CountryIso;
  import com.mangopay.core.enumerations.CultureCode;
  import com.mangopay.core.enumerations.CurrencyIso;
  import java.util.Arrays;
  import java.util.List;

  public class CreateKlarnaPayIn {
      public static void main(String[] args) throws Exception {
          MangoPayApi mangopay = new MangoPayApi();
          mangopay.getConfig().setClientId("your-client-id");
          mangopay.getConfig().setClientPassword("your-api-key");

          PayIn payin = new PayIn();

          User myUser = mangopay.getUserApi().get("user_m_01HT2NFK7Z2BRQNGNHMY30VVTT");
          var walletId = "wlt_m_01HTHTXEF4BJCTKMXNWMSZ6KP5";

          var additionalData = "{\"customer_account_info\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"app_id\": \"81363501-3540-494a-8627-33bc6112035d\",\"loyalty_level\": \"high\",\"customer_email\": \"customer@email.com\",\"customer_phone\": \"0611223344\",\"customer_ranking\": 2,\"customer_reviews\": 5,\"last_login_time\": \"2023-10-21T19:11:34Z\",\"account_security\": {\"last_verification_method\": \"2FA TOTP\",\"last_verification_time\": \"2023-10-21T19:11:34Z\",\"device_id\": \"772af5a5-2d55-4a5e-bb79-85969f683810\",\"fraud_behavior\": false,\"devices_linked\": 2,\"phone_verified\": true,\"email_verified\": true,\"failed_transactions_attempts\": 0},\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": \"2022-12-22T18:45:44Z\"}],\"marketplace_seller_info\": [{\"sub_merchant_id\": \"615a0e87-4941-45dc-978d-e6efcbd90ba0\",\"sub_merchant_name\": \"Marketbrick Ltd.\",\"sub_merchant_postal_code\": \"75010\",\"product_category\": \"Computers\",\"product_name\": \"Asus Zenbook 14\",\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2020-06-10T12:02:21Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2020-06-10T12:02:21Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"digital_download\": false,\"seller_rating\": 4.5,\"number_of_trades\": 34,\"volume_of_trades\": 4500}],\"payment_history_full\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 10,\"payment_option\": \"card\",\"total_amount_paid_purchases\": 1000.10,\"date_of_first_paid_purchase\": \"2020-06-10T12:12:34Z\",\"date_of_last_paid_purchase\": \"2023-10-26T18:52:38Z\"},{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 14,\"payment_option\": \"non klarna credit\",\"total_amount_paid_purchases\": 2322.10,\"date_of_first_paid_purchase\": \"2021-10-11T20:31:15Z\",\"date_of_last_paid_purchase\": \"2023-09-22T14:59:22Z\"}],\"marketplace_winner_info\": [{\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2022-12-22T18:45:44Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2023-08-14T08:23:34Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"number_of_trades\": 24,\"volume_of_trades\": 3322}],\"other_delivery_address\": [{\"shipping_method\": \"pick-up point\",\"shipping_type\": \"express\",\"first_name\": \"Test\",\"last_name\": \"Person\",\"street_address\": \"Rue La Fayette\",\"street_number\": \"33\",\"postal_code\": \"75009\",\"city\": \"Paris\",\"country\": \"FR\"}]}";
          
          Address address = new Address();
          address.setAddressLine1("2795 Edgewood Road");
          address.setCity("Little Rock");
          address.setRegion("Arkansas");
          address.setPostalCode("72212");
          address.setCountry(CountryIso.FR);

          LineItem lineItem1 = new LineItem(null, null, null, null, null);
          lineItem1.setName("Running shoes");
          lineItem1.setQuantity(1);
          lineItem1.setUnitAmount(200);
          lineItem1.setTaxAmount(0);
          lineItem1.setDescription("Seller 1 ID");
          LineItem lineItem2 = new LineItem(null, null, null, null, null);
          lineItem2.setName("Running shoes");
          lineItem2.setQuantity(1);
          lineItem2.setUnitAmount(200);
          lineItem2.setTaxAmount(0);
          lineItem2.setDescription("Seller 2 ID");

          List<LineItem> lineItems = Arrays.asList(lineItem1, lineItem2);

          PayInExecutionDetailsWeb payinExecutionDetails = new PayInExecutionDetailsWeb();
          payinExecutionDetails.setReturnUrl("http://www.mangopay.com/docs/please-ignore");

          PayInPaymentDetailsKlarna paymentDetails = new PayInPaymentDetailsKlarna();
          paymentDetails.setAdditionalData(additionalData);
          paymentDetails.setBilling(new Billing());
          paymentDetails.getBilling().setFirstName("Alex");
          paymentDetails.getBilling().setLastName("Smith");
          paymentDetails.getBilling().setAddress(address);
          paymentDetails.setCountry(CountryIso.FR);
          paymentDetails.setCulture(CultureCode.FR);
          paymentDetails.setReference("1234");
          paymentDetails.setPhone("[+33][689854321]");
          paymentDetails.setEmail(myUser.getEmail());
          paymentDetails.setLineItems(lineItems);

          payin.setPaymentType(PayInPaymentType.KLARNA);
          payin.setExecutionType(PayInExecutionType.WEB);
          payin.setCreditedWalletId(walletId);
          payin.setExecutionDetails(payinExecutionDetails);
          payin.setPaymentDetails(paymentDetails);
          payin.setTag("Created with Mangopay Java SDK");
          payin.setAuthorId(myUser.getId());
          payin.setDebitedFunds(new Money(CurrencyIso.EUR, 400));
          payin.setFees(new Money(CurrencyIso.EUR, 100));
           
          PayIn createKlarnaPayin = mangopay.getPayInApi().create(payin);
          
          Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
          String prettyJson = prettyPrint.toJson(createKlarnaPayin);

          System.out.println(prettyJson);
      } 
  }
  ```

  ```python Python   theme={null}
  from pprint import pprint
  import mangopay

  mangopay.client_id='your-client-id'
  mangopay.apikey='your-api-key'

  from mangopay.api import APIRequest
  handler = APIRequest(sandbox=True)

  from mangopay.resources import NaturalUser, KlarnaPayIn
  from mangopay.utils import Money, Billing, Shipping, Address, LineItem

  natural_user = NaturalUser.get('210513027')

  klarna_payin = KlarnaPayIn(
      author = natural_user,
      credited_wallet_id = '210514820',
      debited_funds = Money(amount=1500, currency='EUR'),
      fees = Money(amount=300, currency='EUR'),
      return_url = 'http://www.mangopay.com/docs/please-ignore',
      statement_descriptor = 'Feb2024',
      billing = Billing(
          first_name = natural_user.first_name,
          last_name = natural_user.last_name,
          address = Address(
              address_line_1 = natural_user.address.address_line_1,
              address_line_2 = natural_user.address.address_line_2,
              city = natural_user.address.city,
              region = natural_user.address.region,
              postal_code = natural_user.address.postal_code,
              country = natural_user.address.country 
          )
      ),
      line_items = [
          LineItem(
              name = 'Running shoes',
              quantity=1,
              unit_amount=400,
              tax_amount=100,
              description='ID of Seller 1'),
          LineItem(
              name = 'Walking shoes',
              quantity=2,
              unit_amount=400,
              tax_amount=100,
              description='ID of Seller 2')
          ],
      shipping = Shipping(
          first_name = natural_user.first_name,
          last_name = natural_user.last_name,
          address = Address(
              address_line_1 = natural_user.address.address_line_1,
              address_line_2 = natural_user.address.address_line_2,
              city = natural_user.address.city,
              region = natural_user.address.region,
              postal_code = natural_user.address.postal_code,
              country = natural_user.address.country,
          )
      ),
      country = natural_user.address.country,
      email = natural_user.email,
      phone = '[+33][689854321]',
      reference = '2345',
      culture = 'FR',
      additional_data = 'your-additional-data',
      tag = 'Created using the Mangopay Python SDK'
  )

  create_klarna_payin = klarna_payin.save()

  pprint(create_klarna_payin)  
  ```

  ```csharp .NET  theme={null}
  using MangoPay.SDK;
  using MangoPay.SDK.Core.Enumerations;
  using MangoPay.SDK.Entities;
  using MangoPay.SDK.Entities.POST;
  using Newtonsoft.Json;

  class Program
  {
      static async Task Main(string[] args)
      {
          MangoPayApi api = new MangoPayApi();

          api.Config.ClientId = "your-client-id";
          api.Config.ClientPassword = "your-api-key";

          var myUser =  await api.Users.GetNaturalAsync("210513027");

          List<LineItem> LineItems = new List<LineItem>();

          var myPayIn = new PayInKlarnaWebPostDTO(
              authorId: myUser.Id,
              debitedFunds: new Money {
                  Amount = 1500,
                  Currency = CurrencyIso.EUR
              },
              fees: new Money {
              Amount = 300,
              Currency = CurrencyIso.EUR
              },
              creditedWalletId: "210514820",
              returnUrl: "http://www.mangopay.com/docs/please-ignore",
              lineItems: new List<LineItem>{
                  new LineItem
                      {
                          Name = "Running shoes",
                          Quantity = 1,
                          UnitAmount = 400,
                          TaxAmount = 100,
                          Description = "ID of Seller 1"
                      },
                      new LineItem
                      {
                          Name = "Walking shoes",
                          Quantity = 2,
                          UnitAmount = 400,
                          TaxAmount = 100,
                          Description = "ID of Seller 2"
                      }
              },
              country: "FR",
              phone: "[+33][689854321]",
              email: myUser.Email,
              additionalData: "{\"customer_account_info\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"app_id\": \"81363501-3540-494a-8627-33bc6112035d\",\"loyalty_level\": \"high\",\"customer_email\": \"customer@email.com\",\"customer_phone\": \"0611223344\",\"customer_ranking\": 2,\"customer_reviews\": 5,\"last_login_time\": \"2023-10-21T19:11:34Z\",\"account_security\": {\"last_verification_method\": \"2FA TOTP\",\"last_verification_time\": \"2023-10-21T19:11:34Z\",\"device_id\": \"772af5a5-2d55-4a5e-bb79-85969f683810\",\"fraud_behavior\": false,\"devices_linked\": 2,\"phone_verified\": true,\"email_verified\": true,\"failed_transactions_attempts\": 0},\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": \"2022-12-22T18:45:44Z\"}],\"marketplace_seller_info\": [{\"sub_merchant_id\": \"615a0e87-4941-45dc-978d-e6efcbd90ba0\",\"sub_merchant_name\": \"Marketbrick Ltd.\",\"sub_merchant_postal_code\": \"75010\",\"product_category\": \"Computers\",\"product_name\": \"Asus Zenbook 14\",\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2020-06-10T12:02:21Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2020-06-10T12:02:21Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"digital_download\": false,\"seller_rating\": 4.5,\"number_of_trades\": 34,\"volume_of_trades\": 4500}],\"payment_history_full\": [{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 10,\"payment_option\": \"card\",\"total_amount_paid_purchases\": 1000.10,\"date_of_first_paid_purchase\": \"2020-06-10T12:12:34Z\",\"date_of_last_paid_purchase\": \"2023-10-26T18:52:38Z\"},{\"unique_account_identifier\": \"382f5a69-c51c-45af-9707-6991eb08f7bf\",\"number_paid_purchases\": 14,\"payment_option\": \"non klarna credit\",\"total_amount_paid_purchases\": 2322.10,\"date_of_first_paid_purchase\": \"2021-10-11T20:31:15Z\",\"date_of_last_paid_purchase\": \"2023-09-22T14:59:22Z\"}],\"marketplace_winner_info\": [{\"account_registration_date\": \"2020-06-10T12:02:21Z\",\"account_last_modified\": {\"password\": \"2022-12-22T18:45:44Z\",\"email\": \"2020-06-10T12:02:21Z\",\"listing\": \"2023-08-14T08:23:34Z\",\"login\": \"2020-06-10T12:02:21Z\",\"address\": \"2020-06-10T12:02:21Z\"},\"number_of_trades\": 24,\"volume_of_trades\": 3322}],\"other_delivery_address\": [{\"shipping_method\": \"pick-up point\",\"shipping_type\": \"express\",\"first_name\": \"Test\",\"last_name\": \"Person\",\"street_address\": \"Rue La Fayette\",\"street_number\": \"33\",\"postal_code\": \"75009\",\"city\": \"Paris\",\"country\": \"FR\"}]}",
              billing: new Billing{
                  FirstName = myUser.FirstName,
                  LastName = myUser.LastName,
                  Address = new Address {
                      AddressLine1 = myUser.Address.AddressLine1,
                      AddressLine2 = myUser.Address.AddressLine2,
                      City = myUser.Address.City,
                      Region = myUser.Address.Region,
                      PostalCode = myUser.Address.PostalCode,
                      Country = myUser.Address.Country
                  },
              },
              reference: "2345",
              culture: "FR",
              tag: "Created using the Mangopay .NET SDK"
          );
      
          var createKlarnaPayIn = await api.PayIns.CreateKlarnaWebAsync(myPayIn);

          string prettyPrint = JsonConvert.SerializeObject(createKlarnaPayIn, Formatting.Indented);
          Console.WriteLine(prettyPrint);
      }
  }
  ```
</RequestExample>
