code: def delete(self, payment_id, data=None):
          
          if not payment_id or not payment_id.startswith(self.RESOURCE_ID_PREFIX):
              raise IdentifierError(
                  "Invalid payment ID: '{id}'. A payment ID should start with '{prefix}'.".format(
                      id=payment_id, prefix=self.RESOURCE_ID_PREFIX)
              )
          result = super(Payments, self).delete(payment_id, data)
          return self.get_resource_object(result)
docs: Cancel payment and return the payment object.
  
          Deleting a payment causes the payment status to change to canceled.
          The updated payment object is returned.