How to Create a Contract

In order for a user to carry out charging sessions, they need to have a valid contract connected to a payment rate (tariff).

First of all, one of the available rates (tariffs) must be chosen via the contractRateOptions API call.

Example contractRateOptions request:

query contractRateOptions {
  contractRateOptions {
    uuid
    id
    name
  }
}

Example response:

{
  "data": {
    "contractRateOptions": [
      {
        "uuid": "05b05111-d0a8-4290-12p3-9ec33d133691",
        "id": "05b05111-d0a8-4290-12p3-9ec33d133691",
        "name": "Standard rate"
      }
    ]
  }
}

One of the available rates (tariffs) on this list has to be used to set up a contract. Depending on the available payment methods (contractPaymentMethods), it is possible to create a contract based on SEPA (createSepaContract) or postpaid (createPostpaidContract) payment methods.

Example contractPaymentMethods request:

query contractPaymentMethods {
  contractPaymentMethods{
    uuid
    applicationId
    paymentType
  }
}

Example response:

{
  "data": {
    "contractPaymentMethods": [
      {
        "uuid": "c6a46407-f3p8-46b7-24po-064324f78b11",
        "applicationId": "SEPA",
        "paymentType": "sepaAccount"
      }
    ]
  }
}

Finally, you can use the uuid from contractRateOptions as the rateId and the uuid from contractPaymentMethods as the id to create a contract via createSepaContract or createPostpaidContract.

mutation createSepaContract {
  createSepaContract(
    sepaContract: {
      id: "c6a46407-f3p8-46b7-24po-064324f78b11"
      rateId: "05b05111-d0a8-4290-12p3-9ec33d133691"
      iban: "AT483200000012345864"
      bic: "SBGSAT2SXXX"
      bank: "Salzburger Sparkasse Bank AG"
      debitType: "b2C"
      accountHolder: "Max Mustermann"
      useParent: true
    }
  ) {
    status
    message
  }
}