Allegro WebAPI

Programming interface of the Allegro platform

doSendPostBuyForm

Last change: 01.09.2011 r.
Availability:
This method allows for filling out and sending the after-sale form. When the after-sale form is successfully sent it is possible to automatically redirect the customer who wishes to make a payment to the website of a proper bank (on condition that the bank enables the pay-by-link option) using the PayU mechanism (more information on integration can be found in service technical documentation: http://goo.gl/6rlFJ [PDF]). Note: at this stage this method does not process the general delivery.

  1. session-id | string | required
    User's session identifier received using the doLogin(Enc) method.
  2. new-post-buy-form-seller | NewPostBuyFormSellerStruct[] | required
    Array of structures containing information on sellers and offers that the form is to be filled out for.
    1. seller-id | int | required
      Seller's identifier.
    2. seller-item-ids | long[] | required
      Array of offer identifiers of a given seller (max. 200, can be loaded by using doGetRelatedItems).
    3. seller-shipment-id | int | required
      Identifier of a common delivery method (can be loaded by using doGetShipmentDataForRelatedItems). For the 'Other delivery method' option, 0 should be passed.
    4. seller-shipment-amount | float | required only for seller-shipment-id = 0 and when methods and costs of delivery do not match in the selected auctions
      Delivery cost.
    5. seller-message-to | string | nonrequired
      Message to seller (max. 1000 characters).
  3. new-post-buy-form-common | NewPostBuyFormCommonStruct | required
    Structure with data from sale form fields.
    1. payment-method-id | string | required
      Payment method identifier (can be loaded by using doGetPaymentMethods).
    2. shipment-address-type | int | required
      Type of delivery address (to be loaded by using doGetMyAddresses). For the 'Other address' option, 0 should be passed.
    3. shipment-address-data | AddressUserDataStruct | required only for shipment-address-type = 0
      Structure with other delivery address.
      1. user-company | string | non-required
        User's company.
      2. user-full-name | string | required
        Name and surname of a user.
      3. user-address | string | required
        User's address.
      4. user-postcode | string | required
        User's postal code.
      5. user-city | string | required
        User's city.
    4. contact-phone | string | non-required
      Buyer's phone number.
    5. invoice-option | int | required
      Information on whether a seller has to issue a VAT invoice (1 - yes, 0 - no; default value is 0).
    6. invoice-info | InvoiceInfoStruct | required only for invoice-option = 1
      Structure containing information on an invoice.
      1. invoice-address-type | int | required
        Type of address to be used in an invoice (to be loaded by using doGetMyAddresses). For the 'Other address' option, 0 should be passed.
      2. invoice-address-data | AddressUserDataStruct | required only for invoice-address-type = 0
        Structure with other address to be used in an invoice.
        1. user-company | string|non-required
          User's company.
        2. user-full-name | string| required
          Name and surname of a user.
        3. user-address | string | required
          User's address.
        4. user-postcode | string | required
          User's postal code.
        5. user-city | string | required
          User's city.
      3. invoice-nip | string | required (non-required if in invoice-option is provided 0)
        User's tax identification number.



Sample structure of method call

$dosendpostbuyform_request = array(
   'session-id' => '22eb99326c6be29aa16d07d622bcfbcbee94ad54846f2f4e03_1',
   'new-post-buy-form-seller' => array(
      array(
         'seller-id' => 1831859,
         'seller-item-ids' => array(1624011084,1624011090),
         'seller-shipment-id' => 4,
         'seller-shipment-amount' => 0,
         'seller-message-to' => 'Please, send the parcel fast. Best regards.')),
   'new-post-buy-form-common' => array(
      'payment-method-id' => 'm',
      'shipment-address-type' => 1,
      'shipment-address-data' => array(),
      'contact-phone' => '601-121-212',
      'invoice-option' => 1,
      'invoice-info' => array(
         'invoice-address-type' => 0,
         'invoice-address-data' => array(
            'user-company' => 'Inter-Komp',
            'user-full-name' => 'Jan Kowalski',
            'user-address' => 'os. B. Chrobrego 3/4',
            'user-post-code' => '60-566',
            'user-city' => 'Poznań'),
         'invoice-nip' => '772-222-33-44'))
);

  1. post-buy-form | PostBuyFormStruct
    Structure with information on sent after-sale form.
    1. transaction-id | long
      Identifier of a created PayU transaction.
    2. transaction-package-ids | long[]
      Identifiers of transactions created outside PayU.
    3. transaction-pay-by-link | TransactionPayByLinkStruct
      Structure with data required to pass payments (only for pay-by-link) of a client to a bank using the PayU mechanism (more information in technical documentation of the service). For payments with personal pick-up, payments made via standard transfer (outside PayU) or for a bank within PayU but without pay-by-link option - an empty structure is returned.
      1. action-http-method | string
        HTTP protocol action defining way of data transmission. Available values – GET, POST.
      2. action-url | string
        Action to be executed.
      3. action-data | ActionDataStruct[]
        A structure with selected action’s data.
        1. action-key | string
          A key to be inserted into action.
        2. action-value | string
          A value to be inserted into action.



Sample structure of server reply

$dosendpostbuyform_response = array(
   'post-buy-form' => array(
      'transaction-id' => 45367221,
      'transaction-package-ids' => array(46353511),
      'transaction-pay-by-link' => array(
         'action-http-method' => 'POST',
         'action-url' => 'https://www.platnosci.pl/np/UTF/newpayment.action',
         'action-data' => array(
            array(
               'action-key' => 'pos_id',
               'action-value' => '33230'),
            array(...),
            array(
               'action-key'  => 'email',
               'action-value'  => 'adres@email.pl'),
            array(...),

            array(
               'action-key'  => 'sig',
               'action-value'  => 'f05216ce23e5e987224de602051740f0'))))
);

  • ERR_INCORRECT_INVOICE_ADDRESS_DATA
    Invalid or blank invoice data.
  • ERR_INCORRECT_INVOICE_ADDRESS_TYPE
    Incorrect or empty invoice address type identifier.
  • ERR_INCORRECT_INVOICE_OPTION
    Incorrect option of invoice selection.
  • ERR_INCORRECT_ITEM_ID
    At least on one provided offer identifiers is incorrect (the offer does not exist, it has been moved to an archive, a logged-in user was not the buyer,  the offer has been listed in different country then the one to which a user is logged-in, the offer is already paid or the payment procedure has been started).
  • ERR_INCORRECT_MESSAGE_TO_SELLER
    Incorrect or too long content of the message to seller (max. 1000 characters).
  • ERR_INCORRECT_PAYMENT_METHOD_ID
    Incorrect or empty payment method identifier.
  • ERR_INCORRECT_SHIPMENT_ID
    Incorrect or empty delivery method identifier.
  • ERR_INCORRECT_SHIPMENT_AMOUNT
    Incorrect (<0 or >300) or empty delivery cost.
  • ERR_INCORRECT_SHIPMENT_ADDRESS_DATA
    Incorrectly filled out or empty structure with delivery address data.
  • ERR_INCORRECT_SHIPMENT_ADDRESS_TYPE
    Incorrect or empty delivery address type identifier.
  • ERR_INVOICE_NOT_POSSIBLE
    You cannot receive an invoice for made purchases if a seller has not selected such option.
  • ERR_ITEM_FROM_OTHER_COUNTRY
    Item is listed in other country than country which user is logged in.
  • ERR_ITEMS_ARRAY_EMPTY_OR_OVERFLOWED
    Array of item identifiers is empty or its acceptable size has been exceeded (200 elements).
  • ERR_NEW_PAYMENT_INTERNAL_ERROR
    Internal system error due to loading PayU transactions.
  • ERR_NO_SESSION / ERR_SESSION_EXPIRED
    Invalid session identifier or the session has expired.
  • ERR_POST_BUY_FORM_ALREADY_FILLED
    Post buy form is allready filled.
  • ERR_TOTAL_AMOUNT_LIMIT
    Acceptable limit of total amount for all items purchased within one transaction has been exceeded (max. 500000 PLN) or amount for credit card payment is <=1.
  • ERR_WEBAPI_KEY_INACTIVE
    The session-generating WebAPI key has been deactivated (the owner did not accept the User Agreement).

Allegro is not to be held liable for consequences of using examples of the published code. It does not guarantee its correct operation either. The code you see serves as an example only and may contain errors.