How to create and close a refund order

The example below explains how to refund one or more tickets. The process is the same for theatres, museums or sport events. In this case, the refund is requeted by the client, the payment method used is cash and the contact is the same who made the purchase. The starting point is a sale order already closed.

Reference data

You must have them under hand before to begin.

Username : CUBE_B2C
Password : P@ssw0rd
Contact : 28579
pointOfSalesId : 466533847 paymentMethodId : cash 16362 - ( both can be obtained through a call to this method)
orderId : 10000000910

Retrieving the sale order

Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:v1="http://v1_31.ExternalOrderService.service.secutix.com"
    xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
   <soapenv:Header>
      <ns2:Security>
         <ns2:UsernameToken>
            <ns2:Username>CUBE_B2C</ns2:Username>
            <ns2:Password>P@ssw0rd</ns2:Password>
         </ns2:UsernameToken>
      </ns2:Security>
   </soapenv:Header>
   <soapenv:Body>
      <v1:getOrderDetails>
         <orderId>10000000910</orderId>
      </v1:getOrderDetails>
   </soapenv:Body>
</soapenv:Envelope>
Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:getOrderDetailsResponse xmlns:ns2="http://v1_31.ExternalOrderService.service.secutix.com">
         <OrderDetailResult>
            <requestId xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <statusCode>success</statusCode>
            <statusDetail xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <orderDetailsData>
               <catalogCurrency>
                  <currencyCode>EUR</currencyCode>
                  <fractionDigit>2</fractionDigit>
                  <minAmount>10</minAmount>
                  <symbol>€</symbol>
               </catalogCurrency>
               <contactReference>28579</contactReference>
               <creationDateTime>2020-08-02T06:29:50.526+02:00</creationDateTime>
               <expirationDate>2020-08-02T09:37:46.185+02:00</expirationDate>
               <movementDatas>
                  <area>Balcon</area>
                  <areaId>466491543</areaId>
                  <areaKind>INDIFFERENT</areaKind>
                  <attributionMatch>NO_EXPECTATION</attributionMatch>
                  <barcode>188686210122415258420148</barcode>
                  <contactReference>28579</contactReference>
                  <entrance>Pair</entrance>
                  <entranceCode>Pair</entranceCode>
                  <entranceId>466491428</entranceId>
                  <movementId>10228237669744</movementId>
                  <operationId>10228237669533</operationId>
                  <resumed>false</resumed>
                  <saleSeatId>63816239</saleSeatId>
                  <scenePhotoLink>garnier/BAL-0-028-4020.jpg</scenePhotoLink>
                  <seatCategory>Cat 1</seatCategory>
                  <seatCategoryId>466494154</seatCategoryId>
                  <seatId>466492057</seatId>
                  <seatNumber>28</seatNumber>
                  <seatOrientation>180</seatOrientation>
                  <seatQuality>Fauteuil</seatQuality>
                  <seatQualityCode>Fauteuil</seatQualityCode>
                  <seatQualityId>2424</seatQualityId>
                  <stageVisibility>VISIBLE</stageVisibility>
                  <taxNumber>01010020516</taxNumber>
                  <titlingVisibility>VISIBLE</titlingVisibility>
                  <type>SEAT</type>
                  <xCoordinate>1912</xCoordinate>
                  <yCoordinate>1848</yCoordinate>
               </movementDatas>
               <movementDatas>
                  <area>Balcon</area>
                  <areaId>466491543</areaId>
                  <areaKind>INDIFFERENT</areaKind>
                  <attributionMatch>NO_EXPECTATION</attributionMatch>
                  <barcode>247268969626123502550133</barcode>
                  <contactReference>28579</contactReference>
                  <entrance>Pair</entrance>
                  <entranceCode>Pair</entranceCode>
                  <entranceId>466491428</entranceId>
                  <movementId>10228237669743</movementId>
                  <operationId>10228237669533</operationId>
                  <resumed>false</resumed>
                  <saleSeatId>63816238</saleSeatId>
                  <scenePhotoLink>garnier/BAL-0-028-4020.jpg</scenePhotoLink>
                  <seatCategory>Cat 1</seatCategory>
                  <seatCategoryId>466494154</seatCategoryId>
                  <seatId>466492051</seatId>
                  <seatNumber>26</seatNumber>
                  <seatOrientation>180</seatOrientation>
                  <seatQuality>Fauteuil</seatQuality>
                  <seatQualityCode>Fauteuil</seatQualityCode>
                  <seatQualityId>2424</seatQualityId>
                  <stageVisibility>VISIBLE</stageVisibility>
                  <taxNumber>01010020515</taxNumber>
                  <titlingVisibility>VISIBLE</titlingVisibility>
                  <type>SEAT</type>
                  <xCoordinate>1868</xCoordinate>
                  <yCoordinate>1848</yCoordinate>
               </movementDatas>
               <movementTicketDatas>
                  <barcode>188686210122415258420148</barcode>
                  <contactReference>28579</contactReference>
                  <linkedToTicketDistribution>false</linkedToTicketDistribution>
                  <movementId>10228237669744</movementId>
                  <taxNumber>01010020516</taxNumber>
                  <ticketId>10228237639427</ticketId>
                  <ticketState>PRINTED</ticketState>
                  <ticketSupport>THERMAL</ticketSupport>
               </movementTicketDatas>
               <movementTicketDatas>
                  <barcode>247268969626123502550133</barcode>
                  <contactReference>28579</contactReference>
                  <linkedToTicketDistribution>false</linkedToTicketDistribution>
                  <movementId>10228237669743</movementId>
                  <taxNumber>01010020515</taxNumber>
                  <ticketId>10228237639426</ticketId>
                  <ticketState>PRINTED</ticketState>
                  <ticketSupport>THERMAL</ticketSupport>
               </movementTicketDatas>
               <operationDatas>
                  <activityType>LIVE_SPECT</activityType>
                  <audienceCatId>15655</audienceCatId>
                  <audienceSubCategory>Adulte</audienceSubCategory>
                  <audienceSubCategoryId>306159078</audienceSubCategoryId>
                  <audienceSubCategoryRank>1</audienceSubCategoryRank>
                  <audienceSubCategoryRequireAttachment>false</audienceSubCategoryRequireAttachment>
                  <basePrice>100000</basePrice>
                  <comfortVariableValues/>
                  <contingentId>0</contingentId>
                  <eventId>466508711</eventId>
                  <exchangeable>false</exchangeable>
                  <fileId>10000000497</fileId>
                  <isNominative>false</isNominative>
                  <itemDisplayExternalDesignation>La Mort à Venise</itemDisplayExternalDesignation>
                  <itemId>466536894</itemId>
                  <kind>SINGLE_ENTRY</kind>
                  <locations>
                     (...)
                  </locations>
                  <numbered>true</numbered>
                  <operationId>10228237669533</operationId>
                  <operationNumber>1</operationNumber>
                  <performance>La Mort à Venise</performance>
                  <performanceAddOnName>Benjamin Britten</performanceAddOnName>
                  <performanceCode>Venic</performanceCode>
                  <performanceDate>2021-01-16T20:00:00+01:00</performanceDate>
                  <performanceDuration>10500</performanceDuration>
                  <performanceId>466508533</performanceId>
                  <physicalConfigurationId>466491326</physicalConfigurationId>
                  <product>La Mort à Venise</product>
                  <productCode>Venic</productCode>
                  <productFamilySubType>SIMPLE_TICKET</productFamilySubType>
                  <productFamilyType>SINGLE_ENTRY</productFamilyType>
                  <productId>466508711</productId>
                  <quantity>2</quantity>
                  <season>Saison 1</season>
                  <seatCategory>Cat 1</seatCategory>
                  <seatCategoryBgColor>E9544F</seatCategoryBgColor>
                  <seatCategoryId>466494154</seatCategoryId>
                  <seatCategoryRank>1</seatCategoryRank>
                  <selfPaidVat>false</selfPaidVat>
                  <site>Théâtre</site>
                  <siteAddress>
                     <countryCode>FR</countryCode>
                     <firstAddressLine>24 rue de Londres</firstAddressLine>
                     <locality>PARIS</locality>
                     <zipCode>75009</zipCode>
                  </siteAddress>
                  <siteId>466491023</siteId>
                  <space>Grande Salle</space>
                  <totalAmount>200000</totalAmount>
                  <unitPrice>100000</unitPrice>
                  <vatCountryCode>FR</vatCountryCode>
                  <vatRate>2100</vatRate>
                  <waitingAccountBalance>0</waitingAccountBalance>
                  <withoutVatTotalAmount>195890</withoutVatTotalAmount>
               </operationDatas>
               <operationDatas>
                  <audienceSubCategoryRequireAttachment>false</audienceSubCategoryRequireAttachment>
                  <basePrice>10000</basePrice>
                  <comfortVariableValues/>
                  <contingentId>0</contingentId>
                  <exchangeable>false</exchangeable>
                  <fileId>10000000497</fileId>
                  <isNominative>false</isNominative>
                  <kind>OVERHEADS</kind>
                  <numbered>false</numbered>
                  <operationId>10228237669535</operationId>
                  <operationNumber>2</operationNumber>
                  <product>Booking fee %</product>
                  <productId>10228193789945</productId>
                  <quantity>1</quantity>
                  <selfPaidVat>false</selfPaidVat>
                  <totalAmount>10000</totalAmount>
                  <unitPrice>10000</unitPrice>
                  <vatCountryCode>FR</vatCountryCode>
                  <vatRate>2100</vatRate>
                  <waitingAccountBalance>0</waitingAccountBalance>
                  <withoutVatTotalAmount>9790</withoutVatTotalAmount>
               </operationDatas>
               <optionAmount>0</optionAmount>
               <orderId>10000000910</orderId>
               <orderInstallmentsToCreate>
                  <dueAmount>210000</dueAmount>
                  <dueDate>2020-08-14T00:00:00+02:00</dueDate>
                  <orderId>10000000910</orderId>
                  <paidAmount>0</paidAmount>
               </orderInstallmentsToCreate>
               <orderOriginData>
                  <countryCode>FR</countryCode>
                  <toCreateToken>false</toCreateToken>
                  <zipCode>75005</zipCode>
               </orderOriginData>
               <orderOriginator>SALE</orderOriginator>
               <orderSecretId>322d6105-c1fc-423e-bb44-07f7cebee018_10000000910</orderSecretId>
               <orderState>CLOSED</orderState>
               <orderType>SALE</orderType>
               <preSaleAmount>0</preSaleAmount>
               <referenceDate>2020-08-02T00:00:00+02:00</referenceDate>
               <reservationAmount>0</reservationAmount>
               <saleAmount>210000</saleAmount>
               <salesChannelCode>Phone</salesChannelCode>
               <salesChannelName>
                  <translations>
                     <locale>fr</locale>
                     <value>Centre d'appels</value>
                  </translations>
                  <translations>
                     <locale>en</locale>
                     <value>Call center</value>
                  </translations>
               </salesChannelName>
               <waitingAccountBalanceAmount>0</waitingAccountBalanceAmount>
            </orderDetailsData>
         </OrderDetailResult>
      </ns2:getOrderDetailsResponse>
   </S:Body>
</S:Envelope>

Here we are interested in the movementTicketDatas blocks for the tickets to refund. For each one of them, extract the movementId, barcode and taxNumber. Also check the ticketState field and be sure that the ticket to refund is not already cancelled.

Creating refund the order

Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
   xmlns:v1="http://v1_31.ExternalOrderFacade.service.secutix.com"
   xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
   <soapenv:Header>
      <ns2:Security>
         <ns2:UsernameToken>
            <ns2:Username>CUBE_B2C</ns2:Username>
            <ns2:Password>P@ssw0rd</ns2:Password>
         </ns2:UsernameToken>
      </ns2:Security>
   </soapenv:Header>
   <soapenv:Body>
      <v1:refundTicketOrder>
         <pointOfSalesId>466533847</pointOfSalesId>
         <orderType>REFUND_CLIENT</orderType>
         <ticketInfos>
            <movementId>10228237669743</movementId>
            <barcode>247268969626123502550133</barcode>
            <taxNumber>01010020515</taxNumber>
         </ticketInfos>
         <autoClose>true</autoClose>
      </v1:refundTicketOrder>
   </soapenv:Body>
</soapenv:Envelope>
Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:refundTicketOrderResponse xmlns:ns2="http://v1_31.ExternalOrderFacade.service.secutix.com">
         <OrderCreationResult>
            <requestId xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <statusCode>success</statusCode>
            <statusDetail xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <expectedException>false</expectedException>
            <orderUpdateData>
               <catalogCurrency>
                  <currencyCode>EUR</currencyCode>
                  <fractionDigit>2</fractionDigit>
                  <minAmount>10</minAmount>
                  <symbol>€</symbol>
               </catalogCurrency>
               <generatedContactQualities/>
               <operationDataUpdates>
                  <activityType>LIVE_SPECT</activityType>
                  <audienceCatId>15655</audienceCatId>
                  <audienceSubCategory>Adulte</audienceSubCategory>
                  <audienceSubCategoryId>306159078</audienceSubCategoryId>
                  <audienceSubCategoryRank>1</audienceSubCategoryRank>
                  <audienceSubCategoryRequireAttachment>false</audienceSubCategoryRequireAttachment>
                  <basePrice>-100000</basePrice>
                  <comfortVariableValues/>
                  <contingentId>0</contingentId>
                  <eventId>466508711</eventId>
                  <exchangeable>false</exchangeable>
                  <fileId>10000000497</fileId>
                  <isNominative>false</isNominative>
                  <itemDisplayExternalDesignation>La Mort à Venise</itemDisplayExternalDesignation>
                  <itemId>466536894</itemId>
                  <kind>SINGLE_ENTRY</kind>
                  <locations>
                     <siteAddress>
                        <countryCode>FR</countryCode>
                        <firstAddressLine>24 rue de Londres</firstAddressLine>
                        <locality>PARIS</locality>
                        <zipCode>75009</zipCode>
                     </siteAddress>
                     <siteCode>Theatre</siteCode>
                     <siteExternalName>
                        <translations>
                           <locale>fr</locale>
                           <value>Théâtre</value>
                        </translations>
                        <translations>
                           <locale>en</locale>
                           <value>Theatre</value>
                        </translations>
                        <translations>
                           <locale>de</locale>
                           <value>Theater</value>
                        </translations>
                        <translations>
                           <locale>es</locale>
                           <value>Teatro</value>
                        </translations>
                     </siteExternalName>
                     <spaceCode>Grande</spaceCode>
                     <spaceExternalName>
                        <translations>
                           <locale>fr</locale>
                           <value>Grande Salle</value>
                        </translations>
                        <translations>
                           <locale>en</locale>
                           <value>Large room</value>
                        </translations>
                        <translations>
                           <locale>de</locale>
                           <value>Grosser Saal</value>
                        </translations>
                        <translations>
                           <locale>es</locale>
                           <value>Gran sala</value>
                        </translations>
                     </spaceExternalName>
                  </locations>
                  <numbered>true</numbered>
                  <operationId>10228288506047</operationId>
                  <operationNumber>1</operationNumber>
                  <performance>La Mort à Venise</performance>
                  <performanceAddOnName>Benjamin Britten</performanceAddOnName>
                  <performanceCode>Venic</performanceCode>
                  <performanceDate>2021-01-16T20:00:00+01:00</performanceDate>
                  <performanceDuration>10500</performanceDuration>
                  <performanceId>466508533</performanceId>
                  <physicalConfigurationId>466491326</physicalConfigurationId>
                  <product>La Mort à Venise</product>
                  <productCode>Venic</productCode>
                  <productFamilySubType>SIMPLE_TICKET</productFamilySubType>
                  <productFamilyType>SINGLE_ENTRY</productFamilyType>
                  <productId>466508711</productId>
                  <quantity>1</quantity>
                  <season>Saison 1</season>
                  <seatCategory>Cat 1</seatCategory>
                  <seatCategoryBgColor>E9544F</seatCategoryBgColor>
                  <seatCategoryId>466494154</seatCategoryId>
                  <seatCategoryRank>1</seatCategoryRank>
                  <selfPaidVat>false</selfPaidVat>
                  <site>Théâtre</site>
                  <siteAddress>
                     <countryCode>FR</countryCode>
                     <firstAddressLine>24 rue de Londres</firstAddressLine>
                     <locality>PARIS</locality>
                     <zipCode>75009</zipCode>
                  </siteAddress>
                  <siteId>466491023</siteId>
                  <space>Grande Salle</space>
                  <totalAmount>-100000</totalAmount>
                  <unitPrice>-100000</unitPrice>
                  <vatCountryCode>FR</vatCountryCode>
                  <vatRate>2100</vatRate>
                  <waitingAccountBalance>0</waitingAccountBalance>
                  <withoutVatTotalAmount>-97940</withoutVatTotalAmount>
               </operationDataUpdates>
               <orderId>10000003442</orderId>
            </orderUpdateData>
         </OrderCreationResult>
      </ns2:refundTicketOrderResponse>
   </S:Body>
</S:Envelope>

In this call, fill the field orderType with REFUND_CLIENT if the refund has been requested by the client, or REFUND_ORGANIZATION if it has been requested by the organization. In this example, only one ticket of the initial sale order of two has been refunded. However, many ticketInfos blocks can be included in the same call, one for each ticket to refund. After this, the refund order is created and verified, ready to be closed. From this response, the next call requires the totalAmount and the orderId.

Closing the order

Query
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:v1="http://v1_31.ExternalOrderFacade.service.secutix.com"
   xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
   <soapenv:Header>
      <ns2:Security>
         <ns2:UsernameToken>
            <ns2:Username>CUBE_B2C</ns2:Username>
            <ns2:Password>P@ssw0rd</ns2:Password>
         </ns2:UsernameToken>
      </ns2:Security>
   </soapenv:Header>
   <soapenv:Body>
      <v1:createPaymentsAndCloseOrder>
         <orderId>10000003442</orderId>
         <payments>
            <amount>-100000</amount>
            <paymentMethodId>16362</paymentMethodId>
         </payments>
         <paymentParams>
            <contactNumber>28579</contactNumber>
         </paymentParams>
         <orderType>REFUND_CLIENT</orderType>
         <maxWaitingTime>10000</maxWaitingTime>
      </v1:createPaymentsAndCloseOrder>
   </soapenv:Body>
</soapenv:Envelope>
Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:createPaymentsAndCloseOrderResponse xmlns:ns2="http://v1_31.ExternalOrderFacade.service.secutix.com">
         <PaymentAndCloseOrderResult>
            <requestId xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <statusCode>success</statusCode>
            <statusDetail xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
            <movementTicketDatas>
               <barcode>247268969626123502550133</barcode>
               <contactReference>28579</contactReference>
               <linkedToTicketDistribution>false</linkedToTicketDistribution>
               <movementId>10228288506148</movementId>
               <taxNumber>01010020515</taxNumber>
               <ticketId>10228237639426</ticketId>
               <ticketState>CANCELLED</ticketState>
               <ticketSupport>THERMAL</ticketSupport>
            </movementTicketDatas>
            <paymentDetails>
               <amount>-100000</amount>
               <catalogCurrency>
                  <currencyCode>EUR</currencyCode>
                  <fractionDigit>2</fractionDigit>
                  <minAmount>10</minAmount>
                  <symbol>€</symbol>
               </catalogCurrency>
               <installment>false</installment>
               <orderId>10000003442</orderId>
               <payerContact>false</payerContact>
               <paymentDate>2020-08-04T14:43:53.065+02:00</paymentDate>
               <paymentId>10228288510374</paymentId>
               <paymentLastUpdated>2020-08-04T14:43:53.065+02:00</paymentLastUpdated>
               <paymentMethod>
                  <code>Espèces</code>
                  <externalName>
                     <translations>
                        <locale>fr</locale>
                        <value>Espèces</value>
                     </translations>
                     <translations>
                        <locale>en</locale>
                        <value>Cash</value>
                     </translations>
                     <translations>
                        <locale>de</locale>
                        <value>Bargeld</value>
                     </translations>
                     <translations>
                        <locale>es</locale>
                        <value>Efectivo</value>
                     </translations>
                  </externalName>
                  <id>16362</id>
                  <manualValidation>false</manualValidation>
                  <paymentType>NUM</paymentType>
               </paymentMethod>
               <paymentStatus>IN_PROGRESS</paymentStatus>
               <referenceDate>2020-08-04T14:43:53+02:00</referenceDate>
               <valueDate>2020-08-04T14:43:53+02:00</valueDate>
            </paymentDetails>
         </PaymentAndCloseOrderResult>
      </ns2:createPaymentsAndCloseOrderResponse>
   </S:Body>
</S:Envelope>

In this example, the payment method used is "Cash". Use the totalAmount and the orderId values from the previous response. If the answer indicates a closing order "in progress", call the method again until you get the information that it is closed.
From the "success" response, we can see how the new movementTicketDatas block for each of the refunded tickets indicate that their ticketState is now CANCELLED.