The payment contract defines what payment methods and what additional payment methods you can use. To change something in your Contract using API you will need additional access rights for this(Currently only secupay users can delete or update a contract). Mostly you will be only allowed to get your data.

Sometimes you will get the access rights to call the method “clone” or “requestId”, which will creates new payment contracts (called sub-contract) with the same configuration of your payment contract. Then you are also allowed to get the data of your sub-contract (but not to modify them).

“clone” is when you want to create a sub-contract for yourself

“requestId” is when you want to create a sub-contract for a third party

Using the secuconnect API one can:

  • create a new contract;
  • clone contract;
  • read the contract data;
  • update an existing contract;
  • delete a contract;
  • read a list of all existing contracts.

Every API user who is able to access the payment service can read his data, and get a list of all existing contracts.

The following parameter MUST be transmitted every time a transaction is created or updated

  • project
  • contact
    • salutation
    • forename
    • surname
    • dob
    • companyname (only in case of a company)
    • address
      • street (street_number)
      • postal_code
      • city
    • email
    • phone
  • payout_account

Example

{
 "project":"project_name 2018-08-29 #000000",
 "contact":{
  "salutation":"Mr.",
  "forename":"John",
  "surname":"Doe",
  "dob":"1901-02-03",
  "address":{
   "street":"Example Street",
   "postal_code":"01234",
   "city":"Examplecity"
  },
  "email":{
   "email":"example@example.com"
  },
  "phone":{
   "phone":"0049-123-456789"
  }
 },
 "payout_account":{
  "iban":"DE89370400440532013000",
  "bic":"",
  "owner":"Test #1"
 }
}

Contract Management

// Contract management
try {
  // Init Data
  PaymentContractsDTORequestId contractRequestId = prepareContractRequestId();

  // Init API interface
  PaymentContractsApi contractsApi = new PaymentContractsApi();
  contractsApi.getApiClient().setAccessToken(accessToken);

  // Send request
  PaymentContractsRequestIdResult contractResult = contractsApi.requestId("me", contractRequestId);

  // Analyse response
  System.out.println("Contract: " + contractResult.toString());
  /*
   * Sample output:
   * ==============
   * Contract: class PaymentContractsRequestIdResult {
   *     contract: class PaymentContractsProductModel {
   *         object: payment.contracts
   *         id: PCR_WAUN605YW2MV3265N0ZAV2V2G3A2A3
   *         parent: class ProductInstanceUID {
   *             object: payment.contracts
   *             id: PCR_3YFT66NUT2MRMZSH70ZAV946082CAW
   *         }
   *         demo: true
   *         allowCloning: false
   *         sepaMandateInform: never
   *         created: 2018-11-07T17:23:39.000+01:00
   *     }
   *     apikey: 270bf4b1f4d5bf923cb4b1ef6e8c62b16377fff9
   * }
   */
} catch (ApiException e) {
  // Fetch errors
  e.printStackTrace();
  System.out.println("ERROR: " + e.getResponseBody());
  return;
}


private static PaymentContractsDTORequestId prepareContractRequestId() {
    PaymentContractsDTORequestId dto = new PaymentContractsDTORequestId();

    // Define the "contact person"
    Contact contact = new Contact();
    contact.setSalutation("Mr."); // mandatory
    contact.setTitle("Dr."); // optional
    contact.setForename("John"); // mandatory
    contact.setSurname("Doe"); // mandatory
    contact.setCompanyname("Example Inc."); // mandatory for companies
    contact.setDob("1901-02-03"); // mandatory
    contact.setEmail("example@example.com"); // mandatory
    contact.setPhone("0049-123-456789"); // mandatory

    Address address = new Address();
    address.setStreet("Example Street"); // mandatory
    address.setStreetNumber("6a"); // can be also in the street, if you have only one field one your side for this
    address.setPostalCode("01234"); // mandatory
    address.setCity("Example-City"); // mandatory
    address.setCountry("DE"); // not mandatory but highly recommended (ISO 3166-1 alpha-2)
    contact.setAddress(address);

    dto.setContact(contact);

    // Define the bank account for payout
    PaymentInformation payoutAccount = new PaymentInformation();
    payoutAccount.setOwner("John Doe");
    payoutAccount.setIban("DE37503240001000000524");
    payoutAccount.setBic("FTSBDEFAXXX"); // not mandatory for "DE" but recommended
    dto.setPayoutAccount(payoutAccount);

    // Define the "project name"
    dto.setProject("Project #" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); // MUST be unique

    return dto;
}